Code Monkey home page Code Monkey logo

Comments (4)

bblanchon avatar bblanchon commented on September 20, 2024 1

Hi @T-vK,

As you can confirm with the ArduinoJson Assistant, the filter you need is this:

{
  "meta": {
    "timestamp": true
  },
  "beats": [
    {
      "start": true
    }
  ],
  "bars": [
    {
      "start": true
    }
  ]
}

You can create this filter like so:

JsonDocument filter;
filter["meta"]["timestamp"] = true;
filter["beats"][0]["start"] = true;
filter["bars"][0]["start"] = true;

In the last part of your message, you say you want to apply logic operators to filters.
Unfortunately, it is not possible at the moment, and I don't see it implemented in the foreseeable future.
This request has been made multiple times (#1721, #1486, #1316, #1708), but we have yet to find a suitable solution.

As a workaround, I suggest you try the deserialization in chunks technique.

Best regards,
Benoit

from arduinojson.

bblanchon avatar bblanchon commented on September 20, 2024 1

Indeed, deserialization in chunks requires significant modifications in your program. I do not have an example that precisely matches your use case, but you can find one that combines both techniques in the Reddit case study of Mastering ArduinoJson.

Are you sure you can't work with just the filter?
Did you check with the ArduinoJson Assistant how much RAM you need?

from arduinojson.

T-vK avatar T-vK commented on September 20, 2024

Ohh, I thought [0] would mean that it just applied to the first item of the array. I actually thought there was a bug because filter["beats"][0] = true; still keeps all beats items not just the first. Thanks for the explanation! 🙏

Chunk deserialization seems to be very invasive in the streaming process. I don't really understand how I would combine the usage of filters and chunk deserialization in order to get rid of some items from some arrays. Are there any examples?

from arduinojson.

T-vK avatar T-vK commented on September 20, 2024

I'll look into it. The issue is that the project I'm working on is already using most of the RAM even without the Spotify integration, so I need to save as much as possible to get a stable result. At the moment songs containing more than n beats will reliably cause my ESP to run out of memory.

from arduinojson.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.