ichilddev
Member
Dear Support & Community.
We have consistency issue running the following script in Pabbly Python.
The script is as such:
import json
def search_preschool(json_data, search_string):
# Parse the JSON data
data = json.loads(json_data)
# Search for the exact string in the 'name' field
for entry in data:
if search_string == entry['name']:
return entry['id'], entry['name']
# If no match is found, return a default message
return "No group found", "No group found"
# Example JSON data
json_data = '''[{"id":"[email protected]","name":"MindChamps@Woodlands"},
{"id":"[email protected]","name":"Brilliant Tots@PotongP"},
{"id":"[email protected]","name":"Carpe Diem@Bukit Batok"},
{"id":"[email protected]","name":"MindChamps@Thomson C"},
{"id":"[email protected]","name":"GUG@Katong V EA"},
{"id":"[email protected]","name":"Red Schhse@Woodleigh NE"},
{"id":"[email protected]","name":"Twinklekidz@Bendemeer"},
{"id":"[email protected]","name":"First Step@Jurong"},
{"id":"[email protected]","name":"Da Little Preschool@Cecil"},
{"id":"[email protected]","name":"ChildFirst@Dunearn EA"},
{"id":"[email protected]","name":"First Step@SK (Initium)"},
{"id":"[email protected]","name":"NurtureStar@Tampines PS"},
{"id":"[email protected]","name":"Safari House"}]'''
# Search string
search_string = "1. GroupName : Blue House Kay Siang HR"
# Call the function
id, name = search_preschool(json_data, search_string)
# Return the results
return id, name
The above results is No group found, No group found
The above works when we use the above exhaustive JSON list.
However when we use the the API to get the JSON list from another application, the attached error is shown.
Kindly advise what is the issue?
We have consistency issue running the following script in Pabbly Python.
The script is as such:
import json
def search_preschool(json_data, search_string):
# Parse the JSON data
data = json.loads(json_data)
# Search for the exact string in the 'name' field
for entry in data:
if search_string == entry['name']:
return entry['id'], entry['name']
# If no match is found, return a default message
return "No group found", "No group found"
# Example JSON data
json_data = '''[{"id":"[email protected]","name":"MindChamps@Woodlands"},
{"id":"[email protected]","name":"Brilliant Tots@PotongP"},
{"id":"[email protected]","name":"Carpe Diem@Bukit Batok"},
{"id":"[email protected]","name":"MindChamps@Thomson C"},
{"id":"[email protected]","name":"GUG@Katong V EA"},
{"id":"[email protected]","name":"Red Schhse@Woodleigh NE"},
{"id":"[email protected]","name":"Twinklekidz@Bendemeer"},
{"id":"[email protected]","name":"First Step@Jurong"},
{"id":"[email protected]","name":"Da Little Preschool@Cecil"},
{"id":"[email protected]","name":"ChildFirst@Dunearn EA"},
{"id":"[email protected]","name":"First Step@SK (Initium)"},
{"id":"[email protected]","name":"NurtureStar@Tampines PS"},
{"id":"[email protected]","name":"Safari House"}]'''
# Search string
search_string = "1. GroupName : Blue House Kay Siang HR"
# Call the function
id, name = search_preschool(json_data, search_string)
# Return the results
return id, name
The above results is No group found, No group found
The above works when we use the above exhaustive JSON list.
However when we use the the API to get the JSON list from another application, the attached error is shown.
Kindly advise what is the issue?