Ashwin
Ashwin

Reputation: 11

Anyone able to read ning's json export files using PHP

I have a client's JSON files that he got from the NING exporter. I'm trying to load the data into PHP but seems like the json isnt properly formatted or something. SO PHP is not able to parse the JSON. I also used another PHP class to do it but that did not work either. Below is the content of one of the files

([{"id":"2492571:Note:75","contributorName":"16szgsc36qg2k","title":"Notes Home","description":"Welcome! To view all notes.","createdDate":"2008-11-14T08:44:58.821Z","updatedDate":"2008-11-14T08:44:58.821Z"}])

Help appreciated!

Upvotes: 0

Views: 538

Answers (3)

user114905
user114905

Reputation: 1

If you'd like to move your Ning data to another platform, you could consider Discourse. There is already an importer for it.

If you don't want to use Discourse, you can still use the (Ruby) importer source code to see how to parse the JSON file.

Upvotes: 0

Thiago Lewin
Thiago Lewin

Reputation: 2828

The JSON file from NING exporter is not properly formatted. For some reason, some commas are missing and you have '}{' pattern, instead of '},{' and the first and the last char is not correct.

You can write a small routine to pre-parse the file and fix those problems and some others that might appear or you can take a look at the code of this Wordpress plugin http://wordpress.org/extend/plugins/import-from-ning/ and copy the routine that fix the json file.

Upvotes: 2

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799310

The parens at the beginning and end are not valid in JSON. It should parse after stripping those.

Upvotes: 2

Related Questions