[spray-json] preserving field order for JSON objects

1,063 views
Skip to first unread message

Ian Forsey

unread,
May 9, 2014, 5:19:00 AM5/9/14
to spray...@googlegroups.com
Hi,

We were curious about the reasoning behind preserving field order in JSON objects in spray-json, since the JSON spec does not require any ordering:


We ran a load test on our application using a Map rather than a ListMap here and saw a big reduction in our memory allocations. About 40% - 100gb -> 60gb.

Would you accept a PR that uses a simple Map here? Maybe behind a configuration option as to not break backwards compatibility.

Thanks

Ian

Mathias Doenitz

unread,
May 9, 2014, 5:28:37 AM5/9/14
to spray...@googlegroups.com
Ian,

> Would you accept a PR that uses a simple Map here? Maybe behind a configuration option as to not break backwards compatibility.

Yes, sure, thanks!

Cheers,
Mathias

---
mat...@spray.io
http://spray.io
> --
> You received this message because you are subscribed to the Google Groups "spray.io User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to spray-user+...@googlegroups.com.
> Visit this group at http://groups.google.com/group/spray-user.
> To view this discussion on the web visit https://groups.google.com/d/msgid/spray-user/0b8ea443-9f87-4480-8bd0-aa3d0f470a9e%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

nic

unread,
Apr 18, 2015, 2:07:43 AM4/18/15
to spray...@googlegroups.com
It would be nice to be able to write objects with a consistent field order, or at least the same order just when the object is the same, so the string represenation of an object is always the same, and then you can just compare strings to know weather two objects are different. This is useful for map-reduce...    ++nic

Mathias Doenitz

unread,
Apr 20, 2015, 5:55:22 AM4/20/15
to spray...@googlegroups.com
Nic,

check out the discussion in this ticket: https://github.com/spray/spray-json/issues/119
on the topic.

Cheers,
Mathias

---
mat...@spray.io
http://spray.io

> --
> You received this message because you are subscribed to the Google Groups "spray.io User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to spray-user+...@googlegroups.com.
> Visit this group at http://groups.google.com/group/spray-user.
> To view this discussion on the web visit https://groups.google.com/d/msgid/spray-user/58ba670f-5843-4176-a8e5-4df5ae983256%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages