Forum: Ruby RUBY script reads a jason

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
478deb011156847f3e4c9dbcc3899cfd?d=identicon&s=25 Sai Charan (charan90)
on 2017-02-16 22:00
Attachment: jason.JPG (100 KB)
I need the parameters from the Jason file which is supplied from the
legacy system to use those parameter values in the program module am
building. can you suggest me any code to read out the jason file.
Let me know if you want me to ask them to modify the jason inorder to be
used by me.

The jason file example is attached in the system.
4828d528e2e46f7c8160c336eb332836?d=identicon&s=25 Robert Heiler (shevegen)
on 2017-02-18 22:05
Pretty awkward way to store JSON as image.

Have you tried to load the file yet?

Try in IRB:

  require "json"

  data = JSON.parse(path)

http://ruby-doc.org/stdlib-2.4.0/libdoc/json/rdoc/...
478deb011156847f3e4c9dbcc3899cfd?d=identicon&s=25 Sai Charan (charan90)
on 2017-02-21 16:10
Robert Heiler wrote in post #1185569:
> Pretty awkward way to store JSON as image.
>
> Have you tried to load the file yet?
>
> Try in IRB:
>
>   require "json"
>
>   data = JSON.parse(path)
>
> http://ruby-doc.org/stdlib-2.4.0/libdoc/json/rdoc/...

Thanks Robert it json has worked for me, the json is in the form of a
notepad i had to take a snap to upload it onto the forum
478deb011156847f3e4c9dbcc3899cfd?d=identicon&s=25 Sai Charan (charan90)
on 2017-02-21 16:15
Could you please help me out with the code to hit the URL to get a
response for the JASON file. I use ruby 1.8.7.



require "net/https"
require "uri"

uri = URI.parse("https://secure.com/")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(uri.request_uri)

response = http.request(request)
response.body
response.status
response["header-here"] # All headers are lowercase



I get this error for running the above code

in `initialize': getaddrinfo: The storage control blocks were destroyed.
(SocketError)



Thanks,
Sai
This topic is locked and can not be replied to.