Reputation: 85
I have this form of data below and I want to convert it into json using java
The problem that the string contains brackets for objects and numbers which means the array ordering...
status=accepted&results[0][id]=7&results[0][name]=data&results[0][score]=9&results[1][name]=data2&results[1][score]=7&results[1][id]=8&reports[0][name]=data1&reports[0][id]=1&reports[0][is_available]=1&reports[1][id]=2&reports[1][name]=data&[email protected]
Thanks
Upvotes: 2
Views: 115
Reputation: 51
If the pattern is fixed, Regular expressions can be used to check the pattern and replace to form JSON.
Check Pattern Replace
Might have to code, depending upon the use case.
E.g., if 2D array elements like results[0][id] have to be converted
{ "results": { "id": 7, "name": "data" } }
Upvotes: 1