Send notes via notehub -> ordering of keys

Hi,
Maybe I’m missing a logical reason…

Why when sending a note from notehub webUI it doesn’t preserve the order of items?
It re-orders the keys to alphabetical.

For example, enter this via web add note:

{“req”:“getcp”,“id”:“00”}

is sent to the card as:

{“id”:“00”,“req”:“getcp”}

also recorded in notehub in alphabetical order…

Is this just the way notehub is processing/checking things?
Or am I just missing something…

Thanks,
Neil

Hi @ndavey,

The “unordered” nature is actually part of the RFC 7159 JSON spec:

An object is an unordered collection of zero or more name/value pairs, where a name is a string and a value is a string, number, boolean, null, object, or array.

Basically, you can never count on any specific order of items in an object. Different libraries and different languages may choose to preserve order, or not (some may even randomize the order to prevent developers from relying upon any defined behavior).

1 Like

Hi Rob,
Ok, thanks…
I thought it might be a case of ‘assume nothing’ re order…
Had not got as far as looking at the RFC’s or any spec…