context for jsonpath with a filter fails to import anything

Created on 10 February 2021, over 4 years ago
Updated 13 June 2021, over 4 years ago

I am trying to use a filter with the context: $.[?(@.type=='Domain' || @.type=='Subdomain')]
And my json file that is to be imported is like:

[
	{
		"id": "1",
		"name": "Indicator",
		"type": "Domain",
		"parentId": "",
		"description": "xxx"
	},
	{
		"id": "2",
		"name": "Indicator Identifying Information",
		"type": "Subdomain",
		"parentId": "1",
		"description": "GLOS-2"
	},
	{
		"id": "3",
		"refNumber": "GLOS-3",
		"name": "Indicator Field",
		"type": "Field",
		"parentId": "1",
		"description": "GLOS-3"
	}
]

I was expecting the first and second elements to be imported, but none was.

If I change the context to just $.*, then all 3 are imported which is not what I would want.

🐛 Bug report
Status

Fixed

Component

JSONPath parser

Created by

🇨🇦Canada theterencechan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • I thnk I have a similar issue with a simple filter.

    Json :

    {
        "result": [
            {
                "room_data": [
                    {
                        "room_info": {
                            "room_type_id": 24,
                            "room_type": "Twin/Double",
                            "min_price": 60.0,
                            "is_work_friendly": false,
                            "bathroom_count": 0,
                            "bedroom_count": 1.0,
                            "bookable": false,
                            "ranking": 1100,
                            "max_price": 147.01,
                            "room_size": {
                                "metre_square": 15.0
                            }
                        },
                        "room_id": 18882701
                    },
                    {
                        "room_info": {
                            "room_type": "Twin/Double",
                            "min_price": 0.0,
                            "room_type_id": 24,
                            "bathroom_count": 0,
                            "is_work_friendly": false,
                            "bookable": false,
                            "bedroom_count": 1.0,
                            "ranking": 0,
                            "max_price": 0.0,
                            "room_size": {
                                "metre_square": 15.0
                            }
                        },
                        "room_id": 18882703
                    }
                ],
                "hotel_id": 188821
            }
        ]
    }

    Context : $.result.*

    Then json source :

    room_data[?(@.room_info.max_price>0)].room_info.max_price
    

    If I change the json source to

    room_data[*].room_info.max_price
    

    then all 2 are imported.

    Any help would be appreciated!

Production build 0.71.5 2024