An object structure is represented as a pair of curly brackets surrounding zero or more name/value pairs (or members). A name is a string. A single colon comes after each name, separating the name from the value. A single comma separates a value from a following name. The names within an object SHOULD be unique.

@pillai, do you have an example of correctly formatted JSON, perhaps in the format of an R character string? I'm sure members of the RStudio Community would be happy to help if provided with a reproducible example.

I'm going to take a stab at this although I'm going to have to assume a couple things.

You want the end result to be a dataframe with one row containing the variables: name, age, sex, category, subcategory and type. Where category, subcategory and type are all nested dataframes containing the variables id and loc. (Note: the values in id will be duplicated the same number of times as the length of loc (3), so it fits in a dataframe.

The parent member classification can actually be removed as seems to add an unneeded level to the structure.

I didn't feel like writing out the JSON as a character string so I created a list mimicking the structure of your proposed JSON.

As @mishabalyasin suggested, jsonlite is a well-rounded package that can convert both to and from JSON. We'll convert the above object your_list to a JSON object, and then coerce it back into a list, this is done with jsonlite::toJSON() and jsonlite::fromJSON(). After this, we'll go ahead and reshape this list so it becomes a nested dataframe with one row, following the assumptions I've mentioned above.

This seems like an odd way of storing the data. But, if I'm understanding you correctly that you want all of those nested dataframes into one long character string, then you can create a function which collapses them together and map that function to each of the nested dataframes. Then, collapse those three columns into one string.