Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while converting to CSV from JSON #8

Closed
ux-engineer opened this issue Apr 29, 2014 · 8 comments
Closed

Error while converting to CSV from JSON #8

ux-engineer opened this issue Apr 29, 2014 · 8 comments

Comments

@ux-engineer
Copy link

Invalid argument supplied for foreach()

  1. ErrorException
    …\vendor\soapbox\laravel-formatter\src\SoapBox\Formatter\Formatter.php415
  2. Illuminate\Exception\Handler handleError
    …\vendor\soapbox\laravel-formatter\src\SoapBox\Formatter\Formatter.php415
  3. SoapBox\Formatter\Formatter is_assoc
    …\vendor\soapbox\laravel-formatter\src\SoapBox\Formatter\Formatter.php162

The JSON seems fine. Could the problem be in that there is an key which value is an object of objects? It works otherwise if I leave that key out.

UPDATE: The same JSON outputs as XML without errors!

@grahammccarthy
Copy link
Member

How many levels deep was the JSON that you are trying to convert to CSV?

Can I get a sample set of data from you to investigate?

Thanks!

@ux-engineer
Copy link
Author

@grahammccarthy Hey! Have you investigated this issue yet? I would need to have this feature implemented during the next week, so I would really appreciate if you could look into to it some day soon.

Update: I sent you the sample JSON via you website contact form + download link. I can resend it if you cannot find it.

@grahammccarthy
Copy link
Member

Hi! It looks like my website blocked your sample JSON. Can you send me an email.

@grahammccarthy
Copy link
Member

The problem with the conversion from your specific example is the multi dimentional json to convert into a flat csv.

{
    "simple":"118",
    "date":"2014-05-20 21:03:59.333",
    "time":"4067",
    "duration_onset":null,
    "devicename":"My Device",
    "calc_data":[
        [
            1400609039,
            0,
            37,
            0,
            0,
            1
        ],
        [
            1400609039,
            0,
            37,
            0,
            0,
            1
        ]
    ]
}

I'll see what i can do!

@ux-engineer
Copy link
Author

Has there been progress on this?

@grahammccarthy
Copy link
Member

Sorry, I gave it a shot over the weekend for an hour and the multi level array conversion to CSV is not well written. I'll have to re-write it, which will take more time. It's a bit busy, and I'm not sure when I can spare some time to work on it. Sorry.

@Fusty
Copy link

Fusty commented Jul 17, 2014

Hello Graham, is the XML portion also only look a single level deep?

@grahammccarthy
Copy link
Member

Hi @Fusty , yeah it does multi level xml! you should be okay to use it. The only problem is multi-level in CSV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants