question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transforming Object into flat form

See original GitHub issue

I am trying to transform an json into a flat form.

Input:

{
  "data": {
    "article_type": "REGULAR",
    "ean": "123",
    "events": [
      {
        "event_id": 1,
        "event_type": "A",
        "production_island": "B",
        "production_island_code": "C",
        "production_location": "Berlin",
        "ql": "A",
        "timestamp": "12/6/2019"
      },
      {
        "event_id": 2,
        "event_type": "A",
        "production_island": "B",
        "production_island_code": "C",
        "production_location": "Berlin",
        "ql": "A",
        "timestamp": "12/6/2019"
      },
      {
        "event_id": 2,
        "event_type": "A",
        "production_island": "B",
        "production_island_code": "C",
        "production_location": "Berlin",
        "ql": "A",
        "timestamp": "12/6/2019"
      }
    ],
    "format": "D",
    "is_sample": true,
    "order_name": "E",
    "order_number": "F",
    "ql": "G",
    "sku": "H"
  },
  "data_op": "U",
  "data_type": "I"
}

Expected:

[
  {
    "article_type": "REGULAR",
    "ean": "123",
    "format": "D",
    "is_sample": true,
    "order_name": "E",
    "order_number": "F",
    "ql": "G",
    "sku": "H",
    "data_op": "U",
    "data_type": "I",
    "event_id": 1,
    "event_type": "A",
    "production_island": "B",
    "production_island_code": "C",
    "production_location": "Berlin",
    "timestamp": "12/6/2019"
  },
  {
    "article_type": "REGULAR",
    "ean": "123",
    "format": "D",
    "is_sample": true,
    "order_name": "E",
    "order_number": "F",
    "ql": "G",
    "sku": "H",
    "data_op": "U",
    "data_type": "I",
    "event_id": 2,
    "event_type": "A",
    "production_island": "B",
    "production_island_code": "C",
    "production_location": "Berlin",
    "timestamp": "12/6/2019"
  },
  {
    "article_type": "REGULAR",
    "ean": "123",
    "format": "D",
    "is_sample": true,
    "order_name": "E",
    "order_number": "F",
    "ql": "G",
    "sku": "H",
    "data_op": "U",
    "data_type": "I",
    "event_id": 2,
    "event_type": "A",
    "production_island": "B",
    "production_island_code": "C",
    "production_location": "Berlin",
    "timestamp": "12/6/2019"
  }
]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
zhangchengkcommented, Dec 8, 2019

Which version of JOLT do you use?I run it in v0.1.1 is normal image

0reactions
M9Tcommented, Dec 8, 2019

Works. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to convert this nested object into a flat object?
If it's an object, we iterate by each object's key. Else, we add it into our result object. function flat(res, key, val, pre...
Read more >
Transforming Object into flat form · Issue #910 · bazaarvoice/jolt
I am trying to transform an json into a flat form. Input: [ { "data": { "article_type": ... Transforming Object into flat form...
Read more >
Flatten JavaScript objects into a single-depth Object
Given a nested JavaScript object, the task is to flatten the object and pull out all the values to a single depth. If...
Read more >
Transform objects in Photoshop - Adobe Support
Learn how to scale layers proportionally and non-proportionally. Rotate, skew, stretch, or warp an image. Apply transformations to a ...
Read more >
Flat Printable Sheets Self Transform Into Shaped Objects
Computer scientists at the Institute of Science and Technology Austria have designed what they called “CurveUps,” or flat sheets that ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found