What is parsing mean?

I want to sound intelligent and I want to do this right the first time. I'm being asked to parse the following file:

{"id":"tag:search.twitter.com,2005:389903668427763712","objectType":"activity","actor":{"objectType":"person","id":"id:twitter.com:91239297","link":"http://www.twitter.com/OGkush103","displayName":"WalkingLick74","postedTime":"2009-11-20T01:21:39.000Z","image":"https://si0.twimg.com/profile_images/378800000593715086/755411d8bdc495472c2d7ed50e319582_normal.jpeg","summary":"Self-Made, Self Paid..... I always had the mind to get it like a man, head first bout my younging Ean! #YOLO","links":[{"href":null,"rel":"me"}],"friendsCount":468,"followersCount":677,"listedCount":0,"statusesCount":25504,"twitterTimeZone":"Alaska","verified":false,"utcOffset":"-28800","preferredUsername":"OGkush103","languages":["en"],"location":{"objectType":"place","displayName":"Boston George Crib"},"favoritesCount":26},"verb":"post","postedTime":"2013-10-15T00:00:53.000Z","generator":{"displayName":"Twitter for iPhone","link":"http://twitter.com/download/iphone"},"provider":{"objectType":"service","displayName":"Twitter","link":"http://www.twitter.com"},"link":"http://twitter.com/OGkush103/statuses/389903668427763712","body":"You a killer you on twitter, You'n do NO talking","object":{"objectType":"note","id":"object:search.twitter.com,2005:389903668427763712","summary":"You a killer you on twitter, You'n do NO talking","link":"http://twitter.com/OGkush103/statuses/389903668427763712","postedTime":"2013-10-15T00:00:53.000Z"},"favoritesCount":0,"location":{"objectType":"place","displayName":"Mississippi, US","name":"Mississippi","country_code":"United States","twitter_country_code":"US","link":"https://api.twitter.com/1.1/geo/id/43d2418301bf1a49.json","geo":{"type":"Polygon","coordinates":[[[-91.65500899999999,30.146096],[-91.65500899999999,34.996099],[-88.097888,34.996099],[-88.097888,30.146096]]]}},"geo":{"type":"Point","coordinates":[31.99686058,-88.72688823]},"twitter_entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[]},"twitter_filter_level":"medium","twitter_lang":"en","retweetCount":0,"gnip":{"matching_rules":[{"tag":null}],"language":{"value":"en"}}}

"id:twitter.com:91239297"," is one of the fields that I've got to capture. They're wanting a csv file at the end, so what does that mean? Does that mean they want something like this:

column name: "id:twitter.com:91239297","
cell info: ","link":"http://www.twitter.com/OGkush103","displayName":"WalkingLick74","postedTime":"2009-11-20T01:21:39.000Z","image":"https://si0.twimg.com/profile_images/378800000593715086/755411d8bdc495472c2d7ed50e319582_normal.jpeg","summary":"Self-Made, Self Paid..... I always had the mind to get it like a man, head first bout my younging Ean! #YOLO","links":[{"href":null,"rel":"me"}],"friendsCount":468,"followersCount":677,"listedCount":0,"statusesCount":25504,"twitterTimeZone":"Alaska","verified":false,"utcOffset":"-28800","preferredUsername":"OGkush103","languages":["en"],"location":{"objectType":"place","displayName":"Boston George Crib"},"favoritesCount":26},"verb":"post",

column name: "postedTime":"2013-10-15T00:00:53.000Z","generator":{"displayName":"Twitter for iPhone","
cell info: ","link":"http://twitter.com/download/iphone"},"provider":{"objectType":"service","displayName":"Twitter","link":"http://www.twitter.com"},"link":"http://twitter.com/OGkush103/statuses/389903668427763712","body":"You a killer you on twitter, You'n do NO talking","object":{"objectType":"note","id":"object:search.twitter.com,2005:389903668427763712","summary":"You a killer you on twitter, You'n do NO talking","link":"http://twitter.com/OGkush103/statuses/389903668427763712","postedTime":"2013-10-15T00:00:53.000Z"},"favoritesCount":0,"location":{"objectType":"place","displayName":"Mississippi, US","name":"Mississippi","country_code":"United States","twitter_country_code":"US","link":"https://api.twitter.com/1.1/geo/id/43d2418301bf1a49.json","geo":{"type":"Polygon","coordinates":[[[-91.65500899999999,30.146096],[-91.65500899999999,34.996099],[-88.097888,34.996099],[-88.097888,30.146096]]]}},

Open in new window


I'm shooting in the dark, here. Any guidance would be very cool!

Thanks!
brucegustPHP DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MontoyaProcess Improvement MgrCommented:
Parsing, in this context, is simply "reading" through the whole thing, and making it easy to identify one piece from another.

if I parse inigo.montoya@myplace.com, I could get:
           Inigo
           Montoya
           myplace.com
0
leakim971PluritechnicianCommented:
FIRST, test it here : http://www.jslint.com/
if valid, play with it here : http://jsonviewer.stack.hu/
0
MontoyaProcess Improvement MgrCommented:
In your case, you will probably load the whole thing, maybe into an array, and you will parse it into intelligent pieces.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
parsing is when you extract specific pieces of data from a data source. In this case, the data source is a string, in JSON format. I recommend having a look at this brief article that'll explain how to parse out the data:

http://www.w3schools.com/json/json_eval.asp

here's an example you can use for reference:

<!DOCTYPE html>
<html>
<body>

<h2>Create Object from JSON String</h2>

<p id="demo"></p>

<script>
var text = '{"employees":[' +
'{"firstName":"John","lastName":"Doe" },' +
'{"firstName":"Anna","lastName":"Smith" },' +
'{"firstName":"Peter","lastName":"Jones" }]}';

obj = JSON.parse(text);
document.getElementById("demo").innerHTML =
obj.employees[1].firstName + " " + obj.employees[1].lastName;
</script>

</body>
</html>

Open in new window

0
Ray PaseurCommented:
This looks like a JSON string.  JSON stands for JavaScript Object Notation.  It's useful with many languages in addition to JavaScript.
http://json.org/

JSON has largely supplanted XML for data transport.  It can do more than XML and it's got a better propellant-to-payload ratio, so it's more efficient.  All JSON is UTF-8, so western European accented characters may require conversion from ISO-8859-1 or Windows-1252 encoding.  Information about character encoding is available here.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11880-Unicode-PHP-and-Character-Collisions.html

PHP has the JSON_decode() function that will turn the JSON string back into a PHP object.  Once that is done, you can access the properties of the object with standard PHP OOP notation.  However in this case, the test data is invalid JSON.  Perhaps it was truncated when you posted it?

<?php // demo/temp_brucegust.php
error_reporting(E_ALL);
echo '<pre>';

// SEE TEST DATA AT http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28523915.html
$jso = <<<EOD
{"id":"tag:search.twitter.com,2005:389903668427763712","objectType":"activity","actor":{"objectType":"person","id":"id:twitter.com:91239297","link":"http://www.twitter.com/OGkush103","displayName":"WalkingLick74","postedTime":"2009-11-20T01:21:39.000Z","image":"https://si0.twimg.com/profile_images/378800000593715086/755411d8bdc495472c2d7ed50e319582_normal.jpeg","summary":"Self-Made, Self Paid..... I always had the mind to get it like a man, head first bout my younging Ean! #YOLO","links":[{"href":null,"rel":"me"}],"friendsCount":468,"followersCount":677,"listedCount":0,"statusesCount":25504,"twitterTimeZone":"Alaska","verified":false,"utcOffset":"-28800","preferredUsername":"OGkush103","languages":["en"],"location":{"objectType":"place","displayName":"Boston George Crib"},"favoritesCount":26},"verb":"post","postedTime":"2013-10-15T00:00:53.000Z","generator":{"displayName":"Twitter for iPhone","link":"http://twitter.com/download/iphone"},"provider":{"objectType":"service","displayName":"Twitter","link":"http://www.twitter.com"},"link":"http://twitter.com/OGkush103/statuses/389903668427763712","body":"You a killer you on twitter, You'n do NO talking","object":{"objectType":"note","id":"object:search.twitter.com,2005:389903668427763712","summary":"You a killer you on twitter, You'n do NO talking","link":"http://twitter.com/OGkush103/statuses/389903668427763712","postedTime":"2013-10-15T00:00:53.000Z"},"favoritesCount":0,"location":{"objectType":"place","displayName":"Mississippi, US","name":"Mississippi","country_code":"United States","twitter_country_code":"US","link":"https://api.twitter.com/1.1/geo/id/43d2418301bf1a49.json","geo":{"type":"Polygon","coordinates":[[[-91.65500899999999,30.146096],[-91.65500899999999,34.996099],[-88.097888,34.996099],[-88.097888,30.146096]]]}},"geo":{"type":"Point","coordinates":[31.99686058,-88.72688823]},"twitter_entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[]},"twitter_filter_level":"medium","twitter_lang":"en","retweetCount":0,"gnip":{"matching_rules":[{"tag":null}],"language":{"value":"en"}}}

"id:twitter.com:91239297"," is one of the fields that I've got to capture. They're wanting a csv file at the end, so what does that mean? Does that mean they want something like this:

column name: "id:twitter.com:91239297","
cell info: ","link":"http://www.twitter.com/OGkush103","displayName":"WalkingLick74","postedTime":"2009-11-20T01:21:39.000Z","image":"https://si0.twimg.com/profile_images/378800000593715086/755411d8bdc495472c2d7ed50e319582_normal.jpeg","summary":"Self-Made, Self Paid..... I always had the mind to get it like a man, head first bout my younging Ean! #YOLO","links":[{"href":null,"rel":"me"}],"friendsCount":468,"followersCount":677,"listedCount":0,"statusesCount":25504,"twitterTimeZone":"Alaska","verified":false,"utcOffset":"-28800","preferredUsername":"OGkush103","languages":["en"],"location":{"objectType":"place","displayName":"Boston George Crib"},"favoritesCount":26},"verb":"post",

column name: "postedTime":"2013-10-15T00:00:53.000Z","generator":{"displayName":"Twitter for iPhone","
cell info: ","link":"http://twitter.com/download/iphone"},"provider":{"objectType":"service","displayName":"Twitter","link":"http://www.twitter.com"},"link":"http://twitter.com/OGkush103/statuses/389903668427763712","body":"You a killer you on twitter, You'n do NO talking","object":{"objectType":"note","id":"object:search.twitter.com,2005:389903668427763712","summary":"You a killer you on twitter, You'n do NO talking","link":"http://twitter.com/OGkush103/statuses/389903668427763712","postedTime":"2013-10-15T00:00:53.000Z"},"favoritesCount":0,"location":{"objectType":"place","displayName":"Mississippi, US","name":"Mississippi","country_code":"United States","twitter_country_code":"US","link":"https://api.twitter.com/1.1/geo/id/43d2418301bf1a49.json","geo":{"type":"Polygon","coordinates":[[[-91.65500899999999,30.146096],[-91.65500899999999,34.996099],[-88.097888,34.996099],[-88.097888,30.146096]]]}},
EOD;

// DECODING FAILS
$obj = json_decode($jso);
var_dump($obj);

// FIND OUT WHY DECODING FAILS
switch(json_last_error())
{
    case JSON_ERROR_NONE:             echo ' - No errors';
    break;
    case JSON_ERROR_DEPTH:            echo ' - Maximum stack depth exceeded';
    break;
    case JSON_ERROR_STATE_MISMATCH:   echo ' - Underflow or the modes mismatch';
    break;
    case JSON_ERROR_CTRL_CHAR:        echo ' - Unexpected control character found';
    break;
    case JSON_ERROR_SYNTAX:           echo ' - Syntax error, malformed JSON';
    break;
    case JSON_ERROR_UTF8:             echo ' - Malformed UTF-8 characters, possibly incorrectly encoded';
    break;
    case JSON_ERROR_RECURSION:        echo ' - One or more recursive references in the value to be encoded';
    break;
    case JSON_ERROR_INF_OR_NAN:       echo ' - One or more NAN or INF values in the value to be encoded';
    break;
    case JSON_ERROR_UNSUPPORTED_TYPE: echo ' - A value of a type that cannot be encoded was given';
    break;
    default:                          echo ' - Unknown error';
    break;
}

Open in new window

0
brucegustPHP DeveloperAuthor Commented:
So, going back to my task, here's what things start to look like once you start incorporating some indents:

{
      "id": "tag:search.twittercom, 2005:389903668427763712",
      "objectType": "activity",
      "actor": {
            "objectType": "persno",
            "id": "id:twitter.com:91239297",
            "link": "http://www.twiter.com/OGkush103",
            "displayName": "WalkingLick74",
            "postedTime": "2009-11-20T01:21:39.000Z",
            "image": "https://si0.twimg.com/profile_images/378800000593715086/755411d8bdc495472c2d7ed50e319582_normal.jpeg",
            "summary": "Self-Made, Self Paid..... I always had the mind to get it like a man, head first buot my young Ean! #YOLO",

I get it! Now, I'm looking at this: http://konklone.io/json/ That looks like what I need to do, but what's the best approach? Do you use PHP to parse it out and then create a CSV file? How do you get it done?
0
Ray PaseurCommented:
If you want to post the complete and correct JSON string, I'll be glad to show you how we handle these things.  Except for the very simplest JSON strings, you cannot assume it's possible to turn JSON into a CSV because JSON is hierarchical and CSV is more-or-less a flat file format, with no hierarchy.
0
Ray PaseurCommented:
Here's a simplified example.

<?php // demo/temp_brucegust.php
error_reporting(E_ALL);
echo '<pre>';

// REF http://json.org/
// REF http://php.net/manual/en/json.constants.php
// REF http://php.net/manual/en/function.json-decode.php
// REF http://php.net/manual/en/function.json-encode.php
// REF http://php.net/manual/en/function.json-last-error.php
// REF http://php.net/manual/en/function.json-last-error-msg.php

// SEE TEST DATA AT http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28523915.html
$jso = <<<EOD
{
    "id": "tag:search.twittercom, 2005:389903668427763712",
    "objectType": "activity",
    "actor":
    {
        "objectType": "persno",
        "id": "id:twitter.com:91239297",
        "link": "http://www.twiter.com/OGkush103",
        "displayName": "WalkingLick74"
    }
}
EOD;

// IF DECODING SUCCEEDS
$obj = json_decode($jso);
if ($obj)
{
    $x = $obj->objectType;
    $y = $obj->actor->displayName;
    echo PHP_EOL . "$x $y";
}

// IF DECODING FAILS?
if (!$obj) echo json_last_error_message();

function json_last_error_message()
{
    static $errors = array
    ( JSON_ERROR_NONE             => null
    , JSON_ERROR_DEPTH            => 'Maximum stack depth exceeded'
    , JSON_ERROR_STATE_MISMATCH   => 'Underflow or the modes mismatch'
    , JSON_ERROR_CTRL_CHAR        => 'Unexpected control character found'
    , JSON_ERROR_SYNTAX           => 'Syntax error, malformed JSON'
    , JSON_ERROR_UTF8             => 'Malformed UTF-8 characters, possibly incorrectly encoded'
// UNDEFINED BEFORE PHP 5.5
//    , JSON_ERROR_RECURSION        => 'One or more recursive references in the value to be encoded'
//    , JSON_ERROR_INF_OR_NAN       => 'One or more NAN or INF values in the value to be encoded'
//    , JSON_ERROR_UNSUPPORTED_TYPE => 'A value of a type that cannot be encoded was given'
    )
    ;
    $error = json_last_error();
    return array_key_exists($error, $errors)
    ? $errors[$error]
    : "Unknown error ({$error})"
    ;
}

Open in new window

0
brucegustPHP DeveloperAuthor Commented:
Ray, as always, thanks for your time and willingness to share you expertise.

I've attached what was sent to me as a txt file just so I could be certain I was getting everything to you.

Thanks!
sample-json.txt
0
Ray PaseurCommented:
This will show you the whole thing.  The process of "parsing" is just the process of teasing out the contents of the various properties.

<?php // demo/temp_brucegust.php
error_reporting(E_ALL);
echo '<pre>';

// REF http://json.org/
// REF http://php.net/manual/en/json.constants.php
// REF http://php.net/manual/en/function.json-decode.php
// REF http://php.net/manual/en/function.json-encode.php
// REF http://php.net/manual/en/function.json-last-error.php
// REF http://php.net/manual/en/function.json-last-error-msg.php

// SEE TEST DATA AT http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28523915.html#a40339939
$jso = <<<EOD
{"id":"tag:search.twitter.com,2005:389903668427763712","objectType":"activity","actor":{"objectType":"person","id":"id:twitter.com:91239297","link":"http://www.twitter.com/OGkush103","displayName":"WalkingLick74","postedTime":"2009-11-20T01:21:39.000Z","image":"https://si0.twimg.com/profile_images/378800000593715086/755411d8bdc495472c2d7ed50e319582_normal.jpeg","summary":"Self-Made, Self Paid..... I always had the mind to get it like a man, head first bout my younging Ean! #YOLO","links":[{"href":null,"rel":"me"}],"friendsCount":468,"followersCount":677,"listedCount":0,"statusesCount":25504,"twitterTimeZone":"Alaska","verified":false,"utcOffset":"-28800","preferredUsername":"OGkush103","languages":["en"],"location":{"objectType":"place","displayName":"Boston George Crib"},"favoritesCount":26},"verb":"post","postedTime":"2013-10-15T00:00:53.000Z","generator":{"displayName":"Twitter for iPhone","link":"http://twitter.com/download/iphone"},"provider":{"objectType":"service","displayName":"Twitter","link":"http://www.twitter.com"},"link":"http://twitter.com/OGkush103/statuses/389903668427763712","body":"You a killer you on twitter, You'n do NO talking","object":{"objectType":"note","id":"object:search.twitter.com,2005:389903668427763712","summary":"You a killer you on twitter, You'n do NO talking","link":"http://twitter.com/OGkush103/statuses/389903668427763712","postedTime":"2013-10-15T00:00:53.000Z"},"favoritesCount":0,"location":{"objectType":"place","displayName":"Mississippi, US","name":"Mississippi","country_code":"United States","twitter_country_code":"US","link":"https://api.twitter.com/1.1/geo/id/43d2418301bf1a49.json","geo":{"type":"Polygon","coordinates":[[[-91.65500899999999,30.146096],[-91.65500899999999,34.996099],[-88.097888,34.996099],[-88.097888,30.146096]]]}},"geo":{"type":"Point","coordinates":[31.99686058,-88.72688823]},"twitter_entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[]},"twitter_filter_level":"medium","twitter_lang":"en","retweetCount":0,"gnip":{"matching_rules":[{"tag":null}],"language":{"value":"en"}}}
EOD;

// IF DECODING SUCCEEDS
$obj = json_decode($jso);
if ($obj)
{
    // SHOW SOME PARTS OF THE OBJECT
    $x = $obj->objectType;
    $y = $obj->actor->displayName;
    echo PHP_EOL . "$x $y" . PHP_EOL;

    // SHOW THE ENTIRE OBJECT
    var_dump($obj);
}

// IF DECODING FAILS?
if (!$obj) echo json_last_error_message();

function json_last_error_message()
{
    static $errors = array
    ( JSON_ERROR_NONE             => null
    , JSON_ERROR_DEPTH            => 'Maximum stack depth exceeded'
    , JSON_ERROR_STATE_MISMATCH   => 'Underflow or the modes mismatch'
    , JSON_ERROR_CTRL_CHAR        => 'Unexpected control character found'
    , JSON_ERROR_SYNTAX           => 'Syntax error, malformed JSON'
    , JSON_ERROR_UTF8             => 'Malformed UTF-8 characters, possibly incorrectly encoded'
// UNDEFINED BEFORE PHP 5.5
//    , JSON_ERROR_RECURSION        => 'One or more recursive references in the value to be encoded'
//    , JSON_ERROR_INF_OR_NAN       => 'One or more NAN or INF values in the value to be encoded'
//    , JSON_ERROR_UNSUPPORTED_TYPE => 'A value of a type that cannot be encoded was given'
    )
    ;
    $error = json_last_error();
    return array_key_exists($error, $errors)
    ? $errors[$error]
    : "Unknown error ({$error})"
    ;
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brucegustPHP DeveloperAuthor Commented:
0
Slick812Commented:
Sorry Posted after it was answered!
grettings brucegust, , I looked at the TEXT you have for this html JSON string, and you ask about the "parsing" of this string, This may be not so simple to figure out how and what to show as the "Parts" of this string to "chop out" and separate, as you have quite a mix of different types of sub-parts contents here, , ,

There are objects within objects, , and arrays within other objects, , and objects within arrays in other objects, , and there are arrays within arrays within arrays within objects in other places.
There may be very little that the several main object properties have in common to use a simple way to "Sort" out all of the parts of all of the objects and arrays in this thing and place in a single string, or a container, like an array.
in this JSON convert page you gave as  http://konklone.io/json/, I used your json text, and it gives a very "complex" parsing with parse segment IDs like "location/geo/type"

just to show how NON SIMPLE this can get, heres the function on that page that does their parsing -
function doCSV(json) {
    // 1) find the primary array to iterate over
    // 2) for each item in that array, recursively flatten it into a tabular object
    // 3) turn that tabular object into a CSV row using jquery-csv
    var inArray = arrayFrom(json);

    var outArray = [];
    for (var row in inArray)
        outArray[outArray.length] = parse_object(inArray[row]);

    $("span.rows.count").text("" + outArray.length);

    var csv = $.csv.fromObjects(outArray);
    // excerpt and render first 10 rows
    renderCSV(outArray.slice(0, excerptRows));
    showCSV(true);

    // show raw data if people really want it
    $(".csv textarea").val(csv);

    // download link to entire CSV as data
    // thanks to http://jsfiddle.net/terryyounghk/KPEGU/
    // and http://stackoverflow.com/questions/14964035/how-to-export-javascript-array-info-to-csv-on-client-side
    var uri = "data:text/csv;charset=utf-8," + encodeURIComponent(csv);
    $(".csv a.download").attr("href", uri);
  }

  // loads original pasted JSON from textarea, saves to anonymous gist
  // rate-limiting means this could easily fail with a 403.
  function saveJSON() {
    if (!input) return false;
    if (input == lastSaved) return false;

    // save a permalink to an anonymous gist
    var gist = {
      description: "test",
      public: true,
      files: {
        "source.json": {
            "content": input
        }
      }
    };

Open in new window

this has several more functions inside of it, and may take a large amount of time to convert to PHP.

Can you give us some Reason and-or Goal, that needs to be acomplished to have a Result to use on your page, with parts of this jason string displayed? ?
0
brucegustPHP DeveloperAuthor Commented:
Hey, Slick!

I appreciate you reaching out even after the question was answered!

The ultimate goal is to do this:

upload the json.gz file using some kind of interface

Take a look at the question I've got posted here: http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28524113.html. I'm not sure if I would use an "upload" dynamic or a enter the name of the file into a text field, but that's the first step I'm envisioning.

parse it out

You're right in that it's not an easily discernible file, but you've seen what it can and should look like based on your having said you've been out to http://konklone.io/json/ (that's a cool little interface, btw).

identify seven specific fields

I need actor/id, actor/displayName, actor/postedTime, generator/displayName, geo/type, geo/coordinates/0, geo/coordinates/1

export those four column names / data out as a csv file

Right now, I've gotten as far as uncompressing the file using this script:

 //This input should be from somewhere else, hard-coded in this example
$file_name = '00_8ptcd6jgjn201311060000_day.json.gz';
// Raising this value may increase performance
$buffer_size = 4096; // read 4kb at a time
$out_file_name = str_replace('.gz', '', $file_name); 
// Open our files (in binary mode)
$file = gzopen($file_name, 'rb');
$out_file = fopen($out_file_name, 'wb'); 
// Keep repeating until the end of the input file
while(!gzeof($file)) {
// Read buffer-size bytes
// Both fwrite and gzread and binary-safe
  fwrite($out_file, gzread($file, $buffer_size));
}  
// Files are done, close files
fclose($out_file);
gzclose($file);

Open in new window


Not entirely sure where to go from here, but that's the scope of the project.
0
Slick812Commented:
???
I am not sure, but after a Question is answered here at EE, it is considered Incorrect to ask for more "unrelated" information to that question, as you now want a comma separated value parse of the JSON stuff in your string.

I can do CSV from a JSON array, but this question is now answered?

I went to your other question about  "upload" dynamic", however the part about "How can I put those two things together",, does not make any sense to me, sorry, you may need to rework that question to something that has more understandable terminology, as not many other experts have commented there, or even asked questions.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.