Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>That looks a lot like <strong>JSON</strong> to me -- betcha it is. Find out and you can turn the whole string into a hash with fields <code>name</code>, <code>contact</code>, <code>location</code>, etc. using:</p> <pre><code>#!/usr/bin/perl use strict; use warnings FATAL =&gt; qw(all); use JSON::XS; use YAML::XS; my $json = &lt;&lt;HERE; { "name":"BLAHBLAH","contact":{"phone":"12345","twitter":"BLAHBLAH"}, "location": {"address":"NOTTELLING","lat":10,"lng":10,"postalCode":"1234", "city":"BLAH","state":"BLAH","country":"BLAH"}, "categories":[{"id":"BLAH","name":"BLAH"}] } HERE print $json; my $hash_ref = decode_json($json); print Dump $hash_ref-&gt;{location}; </code></pre> <p>I had to add a <code>{</code> between <code>"location":</code> and <code>"address":</code>, guessing that was a typo on your end. Anyway, then the output is:</p> <pre><code>{ "name":"BLAHBLAH","contact":{"phone":"12345","twitter":"BLAHBLAH"}, "location": {"address":"NOTTELLING","lat":10,"lng":10,"postalCode":"1234", "city":"BLAH","state":"BLAH","country":"BLAH"}, "categories":[{"id":"BLAH","name":"BLAH"}] } --- address: NOTTELLING city: BLAH country: BLAH lat: 10 lng: 10 postalCode: '1234' state: BLAH </code></pre> <p>I used <code>YAML::XS</code> for brevity; you don't need that. If you don't see the point yet, consider:</p> <pre><code>print $hash_ref-&gt;{location}-&gt;{state}; </code></pre> <p>gives you <code>BLAH</code>. </p> <p>JSON is "javascript object notation", and it is a common data interchange format for OO languages (such as perl), especially online.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload