Java - How to convert values within JSON String (remove quotes on non-strings)? -


i have string, representing json, e.g.

      {"someid":"2130706433","somevalue":"android","networkid":"0","sometag":"true", ...} 

now want remove quotes, can (numbers , booleans). how best (in java)?

result should like:

       {"someid":2130706433,"somevalue":"android","networkid":0,"sometag":true, ...} 

thanks :)

you can simple regex replace:

jsonstring.replaceall("\"([0-9]+|true)\"", "$1"); 

if every number , boolean in quotes replaced.


Comments

Popular posts from this blog

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -