How to encode JSON data with the strict order of elements/keys

This tutorial shows how to use JSON.simple to encode the following JSON data with the strict order of keys.
As per JSON RFC, an object is an unordered collection of zero or more name/value pairs and most implementations of JSON make no effort to preserve the order of an object's name/value pairs.
If order of the elements are important, it can be done using JSONValue.toJSONString(map) method as shown below

Continue reading