I'm trying to create a custom function that can take in a JSON string of Latitudes and Longitudes and convert it into a list of LatLng objects. I got the code snippet from ChatGPT (forgive me for I have sinned).
Return Type: LatLng (Is List: No, Nullable: Yes)
Arguments:
- Name: Locations
- Type: String (Is List: No, Nullable: Yes)
When I go to test it with this sample JSON string, it keeps returning 'Null', and I don't understand why or how to fix it (and neither does ChatGPT)
Sample JSON String:
[ {"latitude": 40.7128, "longitude": -74.0060}, {"latitude": 34.0522, "longitude": -118.2437}, {"latitude": 37.7749, "longitude": -122.4194} ]