Convert all the number values to string in JSON using Java

770 Views Asked by At

I need to convert all the number values to string in my JSON file to overcome a NumberFormatException due to exceeding the Long.Max_Value limit. I am using json-simple JSONParser and it throws an exception. What's the best way to convert them in Java? At the moment, I can't even parse the file completely due this exception.

1

There are 1 best solutions below

0
On

look this examples https://sites.google.com/site/gson/gson-user-guide . Google gson library is probably what you need:

  1. can convert object to json
  2. can convert json to object

and many other functions