I want to split the JSON data, for example, split the following example into two parts "John" and "Mike".
I simply used StrSplite for processing, but found it tricky when choosing a separator. This method may fail if the data format to be processed is slightly changed.
In the following example, I can extract the data between "data": [ and ], and then split.
However, this example may be more difficult to split, and this has not been considered in cases where John or Mike data contains ],.
This method is prone to errors and is also handled for specific JSON data.
Is there any other simple and effective way to process JSON data?
Thanks.
Code: Select all
"data":[
{
"Name": "John",
"phone": [
{
"type": "home",
"number": "212 555-1234"
},
{
"type": "mobile",
"number": "123 456-7890"
}
]
},
{
"Name": "Mike",
"phone": [
{
"type": "home",
"number": "212 555-5678"
},
{
"type": "mobile",
"number": "123 456-1234"
}
]
}],something