Im writing a program to upload my companies orders to an order review site through a POST request. It takes a JSON Object, and it starts like this
{
"utoken": "XVUYvqaRLPtjfuj1OyNbyqw1cv0R0f76g4PadwmR",
"platform": "general",
However when I create my JSONObject using JSON.simple
JSONObject test = new JSONObject();
test.put("utoken", "awooga");
test.put("platform", "general");
It puts it into alphabetical order when I print it out
{
"platform": "general",
"utoken": "awooga"
Does this matter? I dont think it should, but just want to make certain as I've never ran into this before.
As per JSON standard, official definition of object states:
An object is an unordered set of name/value pairs.
Therefore the order does not matter. Obviously from the perspective of the server receiving the POST request, the order can be parsed from HTTP header and reacted upon. I suppose however this is not of your interest, as it does not make much sense to do so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With