Insert Json into sqlite data base

Hi,
I need to create table and insert below json response into sqlite data base.

{ “parameters”: [ { “name”: “Test”, “value”: “Testing”, “message”: “Success” } ], “statusCode”: 200 }

Have to create Database table as below and insert json response.
Parameters name,Value ,Message,statuscode

How to achieve this in Ruby on rails?

Thanks,
Raja

it can be done without Rails with ruby

You will need this : https://github.com/sparklemotion/sqlite3-ruby

and the gems json depending of your version of ruby

require 'json'
value = '{"val":"test","val1":"test1","val2":"test2"}'
puts JSON.parse(value) # => {"val"=>"test","val1"=>"test1","val2"=>"test2"}


This article might help : https://hackhands.com/ruby-read-json-file-hash/

PS It's a huge security risk to accept input with these character:    # => {"}

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs