DevToys icon indicating copy to clipboard operation
DevToys copied to clipboard

JSON path expression is not filtering result

Open ntg-kanaparthi opened this issue 7 months ago • 1 comments

Current behavior

I was not able to filter data:

[
  {
    "name": "Adeel Solangi",
    "language": "Sindhi",
    "id": "V59OF92YF627HFY0",
    "bio": "Donec lobortis eleifend condimentum. Cras dictum dolor lacinia lectus vehicula rutrum. Maecenas quis nisi nunc. Nam tristique feugiat est vitae mollis. Maecenas quis nisi nunc.",
    "version": 6.1
  },
  {
    "name": "Afzal Ghaffar",
    "language": "Sindhi",
    "id": "ENTOCR13RSCLZ6KU",
    "bio": "Aliquam sollicitudin ante ligula, eget malesuada nibh efficitur et. Pellentesque massa sem, scelerisque sit amet odio id, cursus tempor urna. Etiam congue dignissim volutpat. Vestibulum pharetra libero et velit gravida euismod.",
    "version": 1.88
  },
  {
    "name": "Aamir Solangi",
    "language": "Sindhi",
    "id": "IAKPO3R4761JDRVG",
    "bio": "Vestibulum pharetra libero et velit gravida euismod. Quisque mauris ligula, efficitur porttitor sodales ac, lacinia non ex. Fusce eu ultrices elit, vel posuere neque.",
    "version": 7.27
  }
]

expressions I tried:

  1. $..name
  2. $[1:3].name
  3. $[].name
  4. $[3].name

It's not showing any results in the Test result window:

Image

How to reproduce it (as minimally and precisely as possible)

No response

Expected behavior

It should populate the name property of array of items.

Screenshots

No response

Workaround

No response

Affected platforms

No response

Affected DevToys kind

DevToys (app with GUI)

DevToys Version

version2.0-preview.8

Relevant Assets/Logs

No response

ntg-kanaparthi avatar May 27 '25 07:05 ntg-kanaparthi

It appears that the tester can't handle top level arrays. Properties with arrays are fine; it's just when you have the JSON that is an array of properties, which is valid JSON.

Update: Looking through the DevToys.Tools code, it appears that NewtonSoft.Json is used. It could be beneficial to move to System.Text.Json and maybe a 3rd party project like json-everything. There is a very well-done JSON path tester in that project that could be used instead.

Update to the update: Apparently, I can't let this go :D... I see in the crowdin_main branch that this has been fixed and hopefully that means it is on the horizon for a release. Thanks for your reading my ramblings...

johnmbaughman avatar Jul 16 '25 14:07 johnmbaughman