I am overriding to_json.
When I call to_json on my model I get the following:
{ "integer1": "23", "integer2": "2", "integer3": "4", ... }
I want to_json to return:
{ "Something": "23", "SomethingElse": "2", "AnotherThing": "4", ... }
I have an array that contains the key and its mapping:
"integer1" => "Something", "integer2" => "SomethingElse", "integer3" => "AnotherThing", ....
How can I achieve this?
Convert the hash into what you want:
Get your JSON from that: