Skip to main content

Convert Empty String in a JSON to a "null" value

Below is the example as how user can convert a empty string to a "null" value in a JSON dataset.

Just use the PyCode editor in the Python Code Operations with the below example code. This will change the entire records of JSON from empty string to "null"

"pycode" : """Responsedata=[]
new_data = pycode_data
converted_json = {key: None if value == "" else value for key, value in new_data.items()}
json_result = json.dumps(converted_json, indent=4)
pycode_data=json_result"""