Receiving a JSON string & saving one of the array paramaters to the database as a full string
- by ElTren
Hi I have a JSON string that looks like this (Usingt Rails and a REST service)
{
person:
{
name:"Pepe",
last:"Smith"
hats:[ { team:"lakers", color:"purple"}, { team:"heats", color:"red" }] } }
I want to be able to able to get that JSON, and save the Person to the database, but I want to save the "hats".. as a string to the database; without parsing it or anything like that
i.e. I want to save this to SQL:
hats = "[ { team:"lakers", color:"purple"}, { team:"heats", color:"red" }] }"
Is there a way to do this in rails?