How to store hash-code in json

0 votes

Hi,  i am facing a problem while adding hash-code (int type ) data in json format in my collection. for eg:- i have such type of data (0x7f0200df , 0x7f0200e0 , 0x7f0200e2 etc...etc..) this is nothing but its a image id which are available in file in android. 

So, my question is, how should i store int type of data in json in my collection. i am able to store the hex-code in string format {"key":"0x7f0200df "} like this. but it is not helpful for me.  because when i convert this hex code of type String to int . then i get such type of error(number format exception.)

if i am trying  to store this value(0x7f0200df ) in json formate like this {"key":0x7f0200df } then i get this error Please enter the valid JSON 


So, please provide me the best solution, how should i insert hex-code data type in json format.



closed with the note: Closing this thread as there was no update from last 2 Weeks or more. Please raise a new query if problem persists.
asked Aug 21, 2014 in AppWarp by nilesh (109 points)
closed Sep 17, 2014 by sushil
It should be saved as a String value in JSON object. Try to use BigInteger bi = new BigInteger(hex, 16); and then call bi.intValue(); on it for parsing this string hex value.
Let me know if it helps.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on