I have the following JSON-Structure:
{ "A" : "1", "B" : "2", "RandomOtherName" : "54738" }
How can I extract the key values ("A"
, "B"
, "RandomOtherName"
,...) in ruby (Preferably in to an array)?
require 'json'
data = '{ "A" : "1", "B" : "2", "RandomOtherName" : "54738" }'
JSON.parse(data).keys # => ["A", "B", "RandomOtherName"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With