And specifically, since that question was not even Jackson specific (... that question really is not same at all, it used org.json package), things work exactly as they should:
String json = new ObjectMapper().writeValueAsString(myLinkedHashMap); Did you actually try this before asking the question? -+ Tatu +- On Mon, May 7, 2018 at 11:34 AM, Tatu Saloranta <[email protected]> wrote: > It works just fine, after removing weird usage of `JSONObject`. I have > no idea why that was there, but it does bother me that people cut'n > paste code they do not understand > and then blame library & ask author why is library broken. > Like in this particular case. > > I don't exactly enjoy doing your homework for you but here we are. > > -+ Tatu +- > > > On Mon, May 7, 2018 at 1:46 AM, David Canos <[email protected]> wrote: >> I'm trying to build a json from a LinkedhHashMap, order of keys are >> important so I need to preserve the insertion order (natural order). >> My keys are integers and I always get a json result in an ASC order besides >> the insertion order. >> >> Another similar here: >> https://stackoverflow.com/questions/29491281/building-ordered-json-string-from-linkedhashmap?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa >> >> There's a chance for this using Jackson? >> I know Gson permit it. >> >> Thanks >> >> -- >> You received this message because you are subscribed to the Google Groups >> "jackson-user" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
