-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Filtering large arrays of objects #2072
Comments
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. As a workaround, I suggest you try the deserialization in chunks technique. Best regards, |
Ohh, I thought 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? |
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? |
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. |
Describe the issue
I am sending requests to Spotify's get-audio-analysis API endpoint that returns huge 300kb+ JSONs.
I only want to get:
Environment
Here is the environment that I'm using':
Reproduction
Here is a small snippet that demonstrates the problem.
I would also like to extend the filter to only keep the items of beats/bars that match:
I was not able to find a way to do this. Any ideas?
The text was updated successfully, but these errors were encountered: