Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] json_path returning string literal \n when using union operator #5920

Open
ryansuhartanto opened this issue Apr 23, 2024 · 1 comment
Labels

Comments

@ryansuhartanto
Copy link

ryansuhartanto commented Apr 23, 2024

Bug Report

Current Behavior

Currently, json_path would return the string literal \n when using union operator ([,]).

Expected Behavior

Instead, json_path should return the values with new lines, separated by commas, and contained in brackets ([]).

Additional context/output

Taken from ScoopInstaller/Java#515 (comment).

I am trying to extract the version and UUID from this JSON https://api.azul.com/metadata/v1/zulu/packages?java_version=17&os=windows&arch=x86&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&latest=true&page_size=2.

Using this JSON path should returns 4 different values

$..['distro_version','package_uuid']

Note that https://jsonpath.com/ only accept this syntax

$..distro_version,package_uuid

Currently, the returned value is

[
  17,
  48,
  15,
  0
]\ncef00b50-77db-400a-afdd-b9e391e44631\n[
  17,
  48,
  15,
  0
]\n25351721-5e7e-4eef-a0ef-0c3686b38631

However, I don't think this is a feature and trying to the match regex for it would break if this is changed/fixed.

System details

  • Windows version: 11
  • OS architecture: 64bit
  • PowerShell version: 7.4.2
@chawyehsu
Copy link
Member

Good catch! It should return serialized result rather than a concatenated result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants