I'm new to ruby on rails and I'm trying to manipulate the json data into another json format. I have this Controller,thats calls API service URL:
-----UPDATE ----
I can actually use the rocket symbol by doing the field as "api" not :api as I previously used.
@entrylist = obj['entries'].map do |e|
{ "api"=> e["API"] , "desc"=> e["Description"] }
end
CodePudding user response:
Just need to reference the API/Description methods as keys, not methods:
@entrylist = obj['entries'].map do |e|
{ api: e["API"] , desc: e["Description"] }
end