my problem is that i need the exact same String for hashing them later on. The first String comes from the javascript object with JSON.stringify, and the second one is a java object, mapped from the JSON. I need a method to "use" the stringify method on my java object. All quotes, spaces...need to be exact same because I need the same hashvalue to compare them later on. If someone here has a wink or the same problem, i'll be happy if you share it!! Thanks in advance
Asked
Active
Viewed 89 times
1
-
3Have you looked at GSON – Thalaivar Jan 08 '16 at 11:10
-
possible duplicate of http://stackoverflow.com/questions/22077955/json-stringify-in-java-android – awsome Jan 08 '16 at 11:11
1 Answers
0
i can offer a couple of suggestions if that helps
if you have control over both js and java versions, then normalise the object before json-encoding it (either in both or at least one of them)
try to use a java JSON lib that closely emulates the js version (or vice-versa), eg GSON
write your json-encoder (either in java,js or both), its not that hard

Nikos M.
- 8,033
- 4
- 36
- 43
-
thx man, I'll have a look at GSON, but I think that the normalization could be the way! – Jan 08 '16 at 11:17