So I needed help because my json is wrong and I need to fix it with the code itself.
The JSON is :
{"3704969059":{"Lunar Moth Headwings",100,1680750150,500,"https://tr.rbxcdn.com/5c0a02da770746e4ac9a1760d427f716/150/150/Hat/Png"},"13114264635":{"Cow Beret",70,1682603172,200,"https://tr.rbxcdn.com/7d39a32f04f00844113f4b3ab355517a/150/150/Hat/Png"},"13160317604":{"Insignia Helmet",2500,1682593511,25,"https://tr.rbxcdn.com/55feabd27486feb51eb4f0db2209fecf/150/150/Hat/Png"}}
The error is json.decoder.JSONDecodeError: Expecting ':' delimiter: line 1 column 38 (char 37)
I found the problem and it is that there are numbers and they are not enclosed with double quotes I want to add those double quotes but I am kinda stuck.
I tried searching but didn’t find and relative solution. I just want to make the json proper
3
Answers
Your problem is that the objects which are the values of your top level JSON object do not have field names.
Either change your level two literals into lists (replace the curly brackets with squares)…
… or add relevant field names to the object literal, as below:
This is a better option as it adds context to your data
The data you have is ambiguous as described in an other answer by CJC. It may be a better solution to modify the original scraping code to label this information better. Here is a shorter term solution to your answer that forces the data to read as a dictionary of lists.
If this answers your problem, please consider marking this as the solution.
Maybe the sets in your data should really be lists. If that’s the case then you could do this:
Output:
Note:
This is a massive hack that only works with the data as presented in the question. If the generator of that data was supposed to produce JSON then that’s where the fix needs to be done – not on the client side