Home > Back-end >  How to turn the json format string regular array?
How to turn the json format string regular array?

Time:09-18

Example:
String data=https://bbs.csdn.net/topics/[ {a=1, b={aa=1, bb=1} , c=1} {a=2, b={aa=2, bb=2} , c=2} {a=3, b={aa=3, bb=3} , c=3}

As example, this is a string array, the array can have multiple parameters (a, b, c,... ), one of the parameters such as b there are secondary json, like this should be how to parse the string into a json, the value of the ability to quickly get want? Parsing a while didn't parse out, is there a big ~ under the code on teaching

CodePudding user response:

The replace method do you use all the "=" into ":", and then traverse the string, found ":" put it on the left side of the characters with "" set up, this is the json string
  • Related