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.

How to filter using JSON object instead of array as a source?

See original GitHub issue

Using the JSON as source, I see that we can filter and search by key. But how I do this if my JSON source is not an array, but an object?

My current source is something like that (you can ignore the id, I don’t want to show/search for) and I’m following the documentation (list works well):

Edit: Search does not work either.

[
  {
    "0": {
      "path": "xxxxxxxxxxxxxxxxxxxx",
      "type": "file",
      "sha": "1111111111111111",
      "url": "https://xxxxxxxxxxxxxxxxxxxx"
    },
    "1":  {
      "path": "yyyyyyyyyyyyyy",
      "type": "file",
      "sha": "00000000000",
      "url": "https://yyyyyyyyyyyyyyy"
    }
  }
]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
benjamincanaccommented, May 29, 2020

Hey,

I just made a PR to allow nested properties with dot-notation (#60).

This will allow you to make queries like:

this.$content().where({ 'categories.slug': { $contains : 'A B C' } })
2reactions
benjamincanaccommented, May 28, 2020

Hey guys,

To make sure I understand correctly, what you want is a single json file containing an array, so you can search and get a single item from it?

So flattening the array would do the trick?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to filter JSON Object (JavaScript) - Stack Overflow
filter instead : const result = Object.values(data).filter(item => item.id ... You can use startsWith method to get desired result:
Read more >
JSONata Cheatsheet - Stedi Docs
The data filtering expressions operate on the same basis as for the JSON object source documents. Instead of selecting an array field, you...
Read more >
Perform data operations in Azure Logic Apps - Microsoft Learn
To create an array that has JSON objects built from values in an existing array, use the Select action. For example, you can...
Read more >
How to Use JSONPath to filter JSON data - Telerik Reporting
If the parent object is used directly the report would not display any detail records. Therefore it is more convenient to return an...
Read more >
Loading Data - Tabulator
Tabulator expects the server to JSON formatted array of row data objects. ... can use the filterMode option to send the filter data...
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