Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Of course! Thank you. So the data comes out formatted correctly that way, but then I try and do some manipulation with it and push it back into a hash. But it comes out improperly formatted and out of order. This is what I do
%hashData = ( id => $total_cdr_count, col2 => $total_call_count, col3 => $total_error_count, col4 => $formatMin, col5 => $formatASR, col6 => $formatPDD, col7 => $formatDUR, col8 => $hold_max_date ); push @output, %hashData;
And after encoding, it looks like this
{"myData":["col7",null,"col5",null,"col3",0,"col8","2007-08-10 00:59:5 +8","col2",0,"id",3951,"col4",null ,"col6",null,"col7",null,"col5",null,"col3",0,"col8","2007-08-10 00:59 +:58","col2",0,"id",3961,"col4" ,null,"col6",null,"col7",null,"col5",null,"col3",0,"col8","2007-08-10 +00:59:58","col2",0,"id"
the null is fine, I need to fix a few references, but it's out of order, and it looks like it is putting commas in places where a colon should be for json encoding? Also looks like it isn't putting the {} in between records. Here's an example of what it should look like coming out
{"myData":[{"id":"08-10-2007.00","col2":null,"col3":"I","col4":"0","co +l5":"3951","col6":null,"col7":"8028" ,"col8":"0"},......

In reply to Re^4: JSON module by hallikpapa
in thread JSON module by hallikpapa

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-25 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found