Skip to content

fromJSON corrupts json files #454

@RoganGrant

Description

@RoganGrant

I have run into an odd issue where it appears that loading a JSON file using fromJSON() causes the file to become corrupted without ever explicitly writing. Apologies for the large reprex file, but it seems to be more common on large files such as this one. The code to reproduce is simply:

json = jsonlite::fromJSON(filepath, flatten = TRUE)
json = json$features #unclear if this is necessary to reproduce

On running this, the file size of the json is reduced by ~20MB. If you then try to load the file again as above, it rightfully returns the following error:

Error in parse_con(txt, bigint_as_char) : parse error: premature EOF

                 (right here) ------^

Link: https://drive.google.com/file/d/1aX5nq9iOY-BTxqqIQgnoKqFiMeTaLY0a/view?usp=sharing

Thank you for your help on this and for a fantastic package!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions