I was trying to use jsonlite to work with my JSON requests. I was expecting that applying toJSON() to the result of fromJSON() and writing it to a file will produce the same JSON as the original. Apparently, fromJSON does a lot of type conversion from numeric to character and encloses single values into [].
Are there any parameters I can use to make sure we obtain the same json file by toJSON(fromJSON) or I have to care about all the types of all elements myself.
Maybe this could be achieved by some other R JSON library.
Here is the sample of original JSON and past transformation.
Original:
"target": "LENGTH",
"solvers_list": "TMtmil", "passes_num": 45
Modified:
"target":["LENGTH"],"solvers_list":["TMtmil"],"passes_num":[45]