Reputation: 959
Now my backend send to UI ObjectID as an object with timestamp, machineIdentifier, etc., but in database it stores as hex representation. Is there any way (annotation or something else) to serialize it to json as hex representation?
Upvotes: 0
Views: 41
Reputation: 4437
I solved in this way:
JSONObject idObj = (JSONObject)obj.get("_id");
String strID = (String) idObj.get("$oid");
Upvotes: 1