1

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

1 Answers1

0

i can offer a couple of suggestions if that helps

  1. 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)

  2. try to use a java JSON lib that closely emulates the js version (or vice-versa), eg GSON

  3. 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