Hello guys,
I hope you can help me out here.
I'm trying to get the content of a JSON file here, using the JSON Parse Tool. The Column Content is in JSON Format, however, when I use the JSON Parse tool, I get the following error:
Missing a name for object member, at character position 1.
Can any of you help me out?
With kind regards,
Önder
Solved! Go to Solution.
HI @Lazzanova , will it be possible for you to share the workflow? Also it looks like a conversion error to me.
Thanks.
@Lazzanova , yes thank you that worked, the problem is in the json data you fetched as that's not valid json. json uses ", not '.
You need to use formula tool after fetching the data from your python code and replace all the single qoutes with double quotes and it will work.
I hope it helps.
Thanks.
Hi @Lazzanova ,
In addition to conversion that @grazitti_sapna suggested, something you should investigate is the type of field you are exporting from the python script.
If you are exporting a python Dictionary (Which does look a lot like a JSON), that would explain why Alteryx isn't seeing it as a valid JSON string.
What you could do in your python output is to convert the dictionary to a JSON string using the dumps() function from the JSON module within python. The JSON conversion in python will be much more performant than the string operation to replace the ' with " and you wont have to consider handling issues where ' is in the contents of the JSON values.
See below code snippet from https://stackoverflow.com/questions/26745519/converting-dictionary-to-json
import json
r = {'is_claimed': 'True', 'rating': 3.5} #Sample python dictionary
type(r) #Output dict
r = json.dumps(r)
type(r) #Output str
Thanks guys, I've altered the Python code and made sure the output became with double quotes instead of single quotes.
Problem is solved.
@Lazzanova Glad to know it is fixed, it did not come into my mind that you might not be using json.dump() in the code.
User | Count |
---|---|
19 | |
15 | |
15 | |
9 | |
8 |