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] Using jsonata % for parent node access not working in Backend parser #1016

Open
yosiasz opened this issue Oct 8, 2024 · 0 comments
Open

Comments

@yosiasz
Copy link

yosiasz commented Oct 8, 2024

https://try.jsonata.org/iXnJpt6A5

When using

$.metrics.{'name': name,'unit': unit,'value': value,'timestamp': %.timestamp}

on the following json and with Parser backend

[
  {
    "timestamp": 1706220908,
    "metrics": [
      {
        "name": "p50",
        "unit": "us",
        "value": 56
      },
      {
        "name": "p90",
        "unit": "us",
        "value": 125
      },
      {
        "name": "p99",
        "unit": "us",
        "value": 280
      }
    ],
    "attributes": {
      "git_repo": "https://github.com/mytest/test",
      "branch": "main",
      "git_commit": "6995e2de6891c724bfeb2db33d7b87775f913ad1"
    }
  },
  {
    "timestamp": 1706221200,
    "metrics": [
      {
        "name": "p50",
        "unit": "us",
        "value": 60
      },
      {
        "name": "p90",
        "unit": "us",
        "value": 130
      },
      {
        "name": "p99",
        "unit": "us",
        "value": 300
      }
    ],
    "attributes": {
      "git_repo": "https://github.com/mytest/test",
      "branch": "main",
      "git_commit": "7a9f8c1b2dcf134defabcfe329cf5f9a58c8d9d6"
    }
  }
]

but when using same with jsonata it works

parse-json
| jsonata "$.metrics.{  'name': name,  'unit': unit,  'value': value,  'timestamp': %.timestamp,  'git_repo': %.attributes.git_repo,  'branch': %.attributes.branch,  'git_commit': %.attributes.git_commit}"
@yosiasz yosiasz changed the title using % for parent node access not working in Backend parser using sonata % for parent node access not working in Backend parser Oct 9, 2024
@yosiasz yosiasz changed the title using sonata % for parent node access not working in Backend parser using jsonata % for parent node access not working in Backend parser Oct 9, 2024
@yosiasz yosiasz changed the title using jsonata % for parent node access not working in Backend parser [Bug] sing jsonata % for parent node access not working in Backend parser Oct 9, 2024
@yosiasz yosiasz changed the title [Bug] sing jsonata % for parent node access not working in Backend parser [Bug] Using jsonata % for parent node access not working in Backend parser Oct 9, 2024
@yesoreyeram yesoreyeram moved this to Backlog in OSS Big Tent Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants