JSON Ordering

0 votes

Is it possible to chose the order of which the objects are added to the JSON object?


asked Mar 5, 2014 in AppWarpS2 by scott.woolven (35 points)
retagged Mar 11, 2014 by shepAdmin

2 Answers

+1 vote


Yes you can choose order by using syntax as shown :

HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("orderByDescending", "<Use Key for which ordering is to done>");
This is for android same can be use for other.
answered Mar 6, 2014 by anonymous
0 votes
Can you clarify the JSON you are referring to? Is it for room properties?
answered Mar 6, 2014 by dhruvc (1,099 points)
Sorry, I should have been a bit more specific. I mean the JSON server side which I am broadcasting to all the players in the room. I need to broadcast all of the current players' positions and other information.

Is there a limit to the amount of objects that I can send?

This is the first time I've used JSON so I am fairly unfamiliar with it.
I am assuming you are creating your JSONObject, calling the toString method and then passing that to BroadcastChat.
You can use any String based encoding that you are familiar with or a byte array as well. The AppWarp S2 server side and client side will deliver the message as is. It doesn't try to interpret it as JSON or anything else. So its up to developers on how they use the BroadcastChat or BroadcastUpdatePeers APIs
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 support@shephertz.com