Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
bhaizlett123
Contributor

Json export not valid json

Hello,

I just exported my whole rule base using sk120342 and I am now trying to write a python script to parse through rules json file, but for some reason it keeps erroring out saying its not a valid json file. I tried running this through a json validator and it keeps saying there are multiple root elements, so in order to fix that I just enclosed the entire thing into {json data} and that seemed to fix that issue. But now I am running into another issue which is this 

json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes:

does anyone know how to have that export utility export in a valid json format? Or is there a way to fix this issue so I can parse through this json file?

 

Any help is very much appreciated.

 

0 Kudos
5 Replies
PhoneBoy
Admin
Admin

To actually debug the issue, you’d have to provide the actual json file you got.
This might be better done as a TAC case.

The other option would be to query the API directly which should return the results in JSON format.
However, depending on the size/number of policy layers in the relevant policy package, this may require multiple calls.

0 Kudos
Stuart_Green1
Employee
Employee

A sample output would be really useful to help troubleshoot this (just make sure you've removed anything. It sounds familiar and I'm wondering if the output actually contains multiple JSON structures in a single file which is why the JSON validator tools are showing multiple roots. 

0 Kudos
PhoneBoy
Admin
Admin

Given that it likely requires multiple API calls to generate said file, it wouldn’t surprise me if that file had…multiple JSON structures in it.

0 Kudos
WilltChambering
Explorer

Can confirm, as of 2023: the JSON export is invalid insomuch, at the minimum, it is missing a root enclosing the subsequent JSON structures.

Screenshot 2023-12-19 at 16.58.45.png

0 Kudos
Stuart_Green1
Employee
Employee

Have you tried running the JSON through a validator or through JQ? Having a root element as a list ( [] ) is valid JSON as far as I can tell (backed up here too https://www.json.org/json-en.html)

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events