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

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -