Biocompatible nano-antioxidants composed of natural molecules/materials, such as dopamine and melanin, are of great interest for diverse biomedical applications. However, the lack of understanding of the precise structure of these biomaterials and thus the actual dose of effective components impedes their advancement to translation. Herein, a strategy to mimic in situ melanin formation and explore its antioxidative applications is reported, by developing a PEGylated, phenylboronic-acid-protected L-DOPA precursor (PAD) that can self-assemble into well-defined nanoparticles (PADN). Exposure to oxidative species leads to deprotection of phenylboronic acids, transforming PADN to PEG-L-DOPA, which, similar to the biosynthetic pathway of melanin, can be oxidized and polymerized into an antioxidative melanin-like structure. With ultrahigh stability and superior antioxidative activity, the PADN shows remarkable efficacy in prevention and treatment of acute liver injury/failure. Moreover, the in situ structure transformation enables PADN to visualize damaged tissue noninvasively by photoacoustic imaging. Overall, a bioinspired antioxidant with precise structure and site-specific biological activity for theranostics of oxidative stress-related diseases is described.