Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Rabih El Habta
    Per the help file for filefilter something like:
    Code:
    filefilter theJsonFile.json theJsonFile.json, from("data") to("Root") replace
    Additionally, I'm not sure what a lack of experience programming in Stata has to do with programming in Java. The link that I share previously was to one of the Java classes used by jsonio. That is where changes would need to be made to allow end users to name all of the different objects to their liking. I'm also not sure what you mean when you say the outputs require the nodes to be written without spaces. Everything that comes out conforms to the JSON specification. There are minimizers that you could use to convert the json object to a single string, but unless you are exporting a huge amount of data, the minimization shouldn't make a huge amount of difference (in which case only export the data and if that is still an issue I'm not clear on what your use case is). My knowledge of windows is extraordinarily limited.

    Comment


    • #17
      Hi,

      I have been trying to import a .json file to Stata using jsonio. Unfortunately, however, it only imports the first row of data. Has anyone faced a similar issue and found a solution around it?

      Here is the line of the code that I am using (jsonio v 0.0.8):
      Code:
      jsonio kv, file("~/review-Vermont_10.json") nourl
      Here is where you can find and download the data: https://drive.google.com/file/d/1Gqs...AbeqX13dI/view

      I am facing the same issue when I use insheetjson. In addition, it takes a very longer time to run the code when I use insheetjson compared to jsonio.
      Last edited by Mohamad Soltani; 23 Feb 2023, 16:25.

      Comment


      • #18
        Mohamad Soltani
        Can you provide a link that resolves directly to the JSON and not an 85MB gzip'd file? Without seeing what the file looks like I can only speculate, but my guess is that the file is not a proper JSON file and it may be a JSON Lines file.

        Comment


        • #19
          @wbuchanan

          Unfortunately, the owner of the data does not provide a direct link to the JSON, but the links for downliding the json.gz files. Here is how the data look like:

          { 'user_id': '106533466896145407182', 'name': 'Amy VG', 'time': 1568748357166, 'rating': 5, 'text': "I can't say I've ever been excited about a dentist visit before, but there's a first for everything! Loved my experience at Lush today. Every person in the office was friendly and personable- plus the office itself is gorgeous! Great experience, I highly recommend!", 'pics': [ { 'url': ['https://lh5.googleusercontent.com/p/AF1QipMBzN4BJV9YCObcw_ifNzFPm-u38hO3oimOA8Fb=w150-h150-k-no-p'] }, { 'url': ['https://lh5.googleusercontent.com/p/AF1QipNS1PEXEvadfUlhRkRDJ09id Mxh3CveZGZYuTo5=w150-h150-k-no-p'] } ], 'resp': { 'time': 1568770503975, 'text': 'We love getting to meet new patients like yourself. Thanks for giving our office a chance to take care of your dental needs and thanks for the nice review!' }, 'gmap_id': '0x87ec2394c2cd9d2d:0xd1119cfbee0da6f3' }
          { 'user_id': '101463350189962023774', 'name': 'Jordan Adams', 'time': 1627750414677, 'rating': 5, 'text': 'Cool place, great people, awesome dentist!', 'pics': [ { 'url': ['https://lh5.googleusercontent.com/p/AF1QipNq2nZC5TH4_M7h5xRAd 61hoTgvY1o9lozABguI=w150-h150-k-no-p'] } ], 'resp': { 'time': 1628455067818, 'text': 'Thank you for your five-star review! -Dr. Blake' }, 'gmap_id': '0x87ec2394c2cd9d2d:0xd1119cfbee0da6f3' }

          Comment


          • #20
            Mohamad Soltani unfortunately, that format does not conform with the JSON specification. It is a slightly different format that is called JSON Lines. A version that conformed to the JSON specification for the example you provided would start with [, indicating an array of elements/objects, and the delimiter between the two objects would be the ',' character, and the file would terminate with the ] character indicating the end of the array of elements/objects. There is an alternate API in the Java libraries I used to build jsonio, but it would require a significant amount of effort to program that in a manner that could be abstracted to work with the rest of the code.

            That said, if you have a newer version of Stata (with the Python API), you could install the jsonlines Python module, which would allow you to consume the file into a Python object. Then pass the object to the DataFrame class of the Pandas library and you should be able to push all the data into Stata that way.

            Comment


            • #21
              Excellent program and hosting via Statalist and Github! Personally curious though, is publishing through ssc particularly time consuming or difficult? Far be it of me to gripe, I just haven't updated programs through a Git link.

              Comment


              • #22
                Eric Makela that's a totally fair question to ask. I use Git for VCS normally, so keeping a remote copy hosted on GitHub works fairly seamlessly with my existing workflow. Publishing stuff to SSC in general is fairly quick, easy, and goes off without any issues, assuming you remember to submit. Things get a bit trickier when the packages involve Java binaries since a lot of email filters will automatically assume that the Java binary is malicious code.

                Comment


                • #23
                  For all the competing code development platforms, Git continues to be good hosting choice for both independent and group projects. Much appreciation for continuing to monitor jsonio.

                  Comment

                  Working...
                  X