If/Do/Else doesn't work

I have the following chart, but it doesn’t work, returning null all over.

Please help me make it work

That is really complex for someone to try and troubleshoot by just looking at the screenshot. The screenshot is helpful but you’ll need to post the full JSON response as text in order for someone to check that against the blocks you are using.

Make sure to format the JSON using the </> button in the forums toolbar above your post.

My JSON

{
    "documentation": "https://opencagedata.com/api",
    "licenses": [
        {
            "name": "see attribution guide",
            "url": "https://opencagedata.com/credits"
        }
    ],
    "rate": {
        "limit": 2500,
        "remaining": 2485,
        "reset": 1713312000
    },
    "results": [
        {
            "annotations": {
                "DMS": {
                    "lat": "13° 6' 53.16840'' N",
                    "lng": "109° 18' 19.03644'' E"
                },
                "MGRS": "49PCQ1628350444",
                "Maidenhead": "OK43pc67pn",
                "Mercator": {
                    "x": 12167808.99,
                    "y": 1463158.086
                },
                "OSM": {
                    "edit_url": "https://www.openstreetmap.org/edit?way=1042164566#map=17/13.11477/109.30529",
                    "note_url": "https://www.openstreetmap.org/note/new#map=17/13.11477/109.30529&layers=N",
                    "url": "https://www.openstreetmap.org/?mlat=13.11477&mlon=109.30529#map=17/13.11477/109.30529"
                },
                "UN_M49": {
                    "regions": {
                        "ASIA": "142",
                        "SOUTHEAST_ASIA": "035",
                        "VN": "704",
                        "WORLD": "001"
                    },
                    "statistical_groupings": [
                        "LEDC"
                    ]
                },
                "callingcode": 84,
                "currency": {
                    "alternate_symbols": [],
                    "decimal_mark": ",",
                    "format": "%n %u",
                    "html_entity": "&#x20AB;",
                    "iso_code": "VND",
                    "iso_numeric": "704",
                    "name": "Vietnamese Đồng",
                    "smallest_denomination": 100,
                    "subunit": "Hào",
                    "subunit_to_unit": 1,
                    "symbol": "₫",
                    "symbol_first": 0,
                    "thousands_separator": "."
                },
                "flag": "🇻🇳",
                "geohash": "w6mdx73xjf4h25cz6vwc",
                "qibla": 287.9,
                "roadinfo": {
                    "drive_on": "right",
                    "road": "Nguyễn Hữu Thọ",
                    "road_type": "tertiary",
                    "speed_in": "km/h"
                },
                "sun": {
                    "rise": {
                        "apparent": 1713306660,
                        "astronomical": 1713302340,
                        "civil": 1713305340,
                        "nautical": 1713303840
                    },
                    "set": {
                        "apparent": 1713264900,
                        "astronomical": 1713269220,
                        "civil": 1713266160,
                        "nautical": 1713267660
                    }
                },
                "timezone": {
                    "name": "Asia/Ho_Chi_Minh",
                    "now_in_dst": 0,
                    "offset_sec": 25200,
                    "offset_string": "+0700",
                    "short_name": "+07"
                },
                "what3words": {
                    "words": "xelửa.ýnghĩa.cảitrắng"
                }
            },
            "bounds": {
                "northeast": {
                    "lat": 13.115959,
                    "lng": 109.3069427
                },
                "southwest": {
                    "lat": 13.114769,
                    "lng": 109.3052879
                }
            },
            "components": {
                "ISO_3166-1_alpha-2": "VN",
                "ISO_3166-1_alpha-3": "VNM",
                "ISO_3166-2": [
                    "VN-32"
                ],
                "_category": "road",
                "_normalized_city": "Thành phố Tuy Hòa",
                "_type": "road",
                "city": "Thành phố Tuy Hòa",
                "continent": "Asia",
                "country": "Việt Nam",
                "country_code": "vn",
                "road": "Nguyễn Hữu Thọ",
                "road_type": "tertiary",
                "state": "Tỉnh Phú Yên"
            },
            "confidence": 9,
            "distance_from_q": {
                "meters": 7
            },
            "formatted": "Nguyễn Hữu Thọ, Thành phố Tuy Hòa, Tỉnh Phú Yên, Việt Nam",
            "geometry": {
                "lat": 13.114769,
                "lng": 109.3052879
            }
        }
    ],
    "status": {
        "code": 200,
        "message": "OK"
    },
    "stay_informed": {
        "blog": "https://blog.opencagedata.com",
        "mastodon": "https://en.osm.town/@opencage"
    },
    "thanks": "For using an OpenCage API",
    "timestamp": {
        "created_http": "Tue, 16 Apr 2024 03:25:04 GMT",
        "created_unix": 1713237904
    },
    "total_results": 1
}

The blocks you’re using are getting a text string value and then converting an object to JSON even though it’s not an object at that point and you don’t need JSON.

Please try this for the “lat” property that you’re retrieving for Long1’s Text:

Set Long1’s Text to get property “results[1].geometry.lat” of get object from JSON [response]

That’s shorthand for all of these blocks:

Let me know if that works. If not, please post a screenshot of the modified blocks. Focus on getting that one set of blocks correct and you should be good for working on the next sets.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.