473,378 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Parsing JSON string with Perl when the elements name are unknown

32
Hi,

I would like to parse JSON string using perl.
which is very trivial up until the moment the elements name are unknown.

normally I would use:
Expand|Select|Wrap|Line Numbers
  1. my @elem= @{ $decoded->{'elements'} };
  2. foreach my $el ( @elem) {
  3.   print $el->{"attr"} . "\n";
  4. }
  5.  
How can I do the same assuming I have no knowledge on the elements names (I'm sure there has to be a way to access it using the index, I just could not find it)

THANKS!
Feb 16 '14 #1
0 1167

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Ton den Hartog | last post by:
I am confused, when use ID and when use NAME to identify an element in HTML ? Ton den Hartog -- Computer museum tonh: http://www.tonh.net - 10.000 visitors !! GGGallery website...
50
by: z. f. | last post by:
HI, i have string in format dd/mm/yyyyy hh:mm:ss and giving this as an input to DateTime.Parse gives a string was not recognized as a valid date time format string error. how do i make the parse...
1
by: fusillo | last post by:
i've a problem with the following statement: var eg=eval('('+strjson+')'); making debug with firebug, a firefox extension i got >>> typeof(strjson) "string" >>> inspect(strjson)...
1
by: quantass | last post by:
Im using C#, ASP.NET v1.1. My class contains intrinsic types, ArrayList, and XmlDocument types. Some variables have the value NULL. After usng XmlSerializer and the information on:...
3
by: asleepatdesk | last post by:
Hi, I need some help here. When I try to eval() my AJAX returned JSON string, I continually get a javascript error "Expected )". Here's my JSON string: {"recs": }; My js function simply...
5
by: baju123 | last post by:
Hi, Would anybody tell me an efficient method to parse a string inside a variable which is line separated ... Like this value1: line1 /n value2: line2 /n value3: line3 /n
2
by: bylabylamo | last post by:
i have a problem converting a json string that i get from a servlet into a json object using eval function of java script. any one please help me..........
7
by: Andrew Poulos | last post by:
I'm creating a JSON string and passing it to a SCORM 1.2 compliant LMS thus: var tmp = {}; tmp.assess = assessScore; tmp.loc = location; tmp.progress = notes.topics.toString();...
6
by: pbd22 | last post by:
Hi. I can't seem to get any values from the below string. I have tried myJSONObject.slides, myJSONObject.slides, myJSONObject.slides.1, etc. I can't get it to work. Is it because the NAMES are...
1
by: mohanprasadgutta | last post by:
hello everyone, i have to write a program which will take a command line arguement which is nothing but a constant name. in the program i am trying to print out the value corresponding to the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.