Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: parse json data with underscore symbol

by kevbot (Priest)
on Aug 18, 2018 at 07:25 UTC ( #1220565=note: print w/replies, xml ) Need Help??


in reply to Re: parse json data with underscore symbol
in thread parse json data with underscore symbol

Hello amaa11,

I see that you added the code tags, but now your code is no longer valid perl syntax due to the appearance of extra <br> tags on every line.

UPDATE: I see that you fixed the formatting problems, but now when I run your code I get an error related to improperly formatted JSON. When I run your code as is, I get this error '"' expected, at character offset 811 (before "<br>\n        "count...") at t.pl line 108. When I manually remove the offending <br> tag, I finally get the error that you mentioned Not a HASH reference at t.pl line 110.

Replies are listed 'Best First'.
Re^3: parse json data with underscore symbol
by amaa11 (Initiate) on Aug 18, 2018 at 07:43 UTC
    Dear kevbot,
    Yes I updated the all post as you asked
    still have a small problem when I print the second element in the array
    print 'ge= ' . $decoded->{_embded}{stes}[1]{ge}, "\n"
    I got this error.
    Use of uninitialized value in concatenation (.) or string
      The array reference given by $decoded->{_embded}{stes} only has one element so the data is at index 0. Try this, $decoded->{_embded}{stes}[0]{ge}

        Dear Kevbot, Thanks a lot for providing me these info.
        Just imagine that I have a very long of the data (Json) as i posted in the post. And I wand print all what I want by a loop to parse all the data.
        Can you suggest any module or way to do that??
        Regards

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1220565]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2019-05-21 10:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (132 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!