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":"120@g.us","name":"MindChamps@Woodlands"},
{"id":"1203@g.us","name":"Brilliant Tots@PotongP"},
{"id":"120@g.us","name":"Carpe Diem@Bukit Batok"},
{"id":"65@g.us","name":"MindChamps@Thomson C"},
{"id":"659@g.us","name":"GUG@Katong V EA"},
{"id":"659@g.us","name":"Red Schhse@Woodleigh NE"},
{"id":"659@g.us","name":"Twinklekidz@Bendemeer"},
{"id":"12036@g.us","name":"First Step@Jurong"},
{"id":"120@g.us","name":"Da Little Preschool@Cecil"},
{"id":"6582@g.us","name":"ChildFirst@Dunearn EA"},
{"id":"6582@g.us","name":"First Step@SK (Initium)"},
{"id":"659@g.us","name":"NurtureStar@Tampines PS"},
{"id":"12036@g.us","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":"120@g.us","name":"MindChamps@Woodlands"},
{"id":"1203@g.us","name":"Brilliant Tots@PotongP"},
{"id":"120@g.us","name":"Carpe Diem@Bukit Batok"},
{"id":"65@g.us","name":"MindChamps@Thomson C"},
{"id":"659@g.us","name":"GUG@Katong V EA"},
{"id":"659@g.us","name":"Red Schhse@Woodleigh NE"},
{"id":"659@g.us","name":"Twinklekidz@Bendemeer"},
{"id":"12036@g.us","name":"First Step@Jurong"},
{"id":"120@g.us","name":"Da Little Preschool@Cecil"},
{"id":"6582@g.us","name":"ChildFirst@Dunearn EA"},
{"id":"6582@g.us","name":"First Step@SK (Initium)"},
{"id":"659@g.us","name":"NurtureStar@Tampines PS"},
{"id":"12036@g.us","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?