How to get the full JSON?


#1

I am working on development, but the documentation still seems to be fairly sparse. For example, I see in the Ruby football.rb document it shows:

interaction[‘interaction’][‘type’]
interaction[‘interaction’][‘content’]

…to receive “type” and “content” respectively, but what if I want to store the entire JSON stream into a database? I looked through the documentation and I can’t see anywhere an option to take the entire raw JSON output and use it.


#2

 

We have included the yajl JSON parsing and encoding library f you need to play with the JSON object. Yajl JSON Library Docs

The 'interaction' object is the raw object. If you wanted to format it into regular JSON, you could use the following code snippet:

json = Yajl::Encoder.encode(interaction)

You can then use the JSON object in whatever way you liked to take it apart or save it to a database. 

For debugging, you might be interested to see a clean indented view of the JSON object:

json = Yajl::Encoder.encode(interaction, :pretty => true, :indent => "\t")

I hope this has helped.


#3

Yes. Thank you - that really helps :slight_smile: