Answer the question
In order to leave comments, you need to log in
Convert string to JSON in Java?
I have a string:
(this is a list of primary school students)
I need to do the following from this line:
{
"students": [
{
"sur": "Kozlov",
"mark": 3,
"subject": "Mathematics"
},
(and so on for all students)
]}
Please help me, what function should I use ? How to remake?
Thanks in advance
Answer the question
In order to leave comments, you need to log in
Well, the original string is not JSON, so you need to parse it according to the known structure, create objects and convert it to JSON with some GSON. For parsing in this case, regular expressions are enough, it should turn out quite simply.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question