Reputation: 4814
I am converting processes map to JSON
using jackson 2.6.2
automatically.
Map<Long,String> processes = new HashMap<>();
processes.add(1l,"p1");
processes.add(2l,"p2");
The resultant JSON is coming in String: String
format:
{
"1": "p1",
"2": "p2"
}
How to retain Long Number as Number only in JSON i.e., Number: String
like below:
{
1: "p1",
2: "p2"
}
Upvotes: 0
Views: 251
Reputation: 403
Keys of the Javascript objects are always parsed as string.
In object literal terms, key is a property. Properties are strings in JavaScript.
Upvotes: 3