Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Added a new Example : JSON Value Extractor #7

Merged

Conversation

Chester-King
Copy link
Contributor

Greetings,

This sketch demonstrates how to use some features of the Official Arduino JSON library to traverse through all the key value pair in the object and the nested objects. Can be very helpful when searching for a specific data in a key which is nested at multiple levels The sketch actually uses recursion to traverse all the keys in a given JSON.

@Chester-King
Copy link
Contributor Author

Issue #6 is addressed in this PR. For instance assuming your hardware is getting some data from the cloud in JSON format. For example when we get data from firebase in JSON format. At times the only data we need to work with Temperature and Smoke and they both are at different levels of JSON. Let's say you have a JSON Object

{
sensor1:{
temp : 39,
humidity : 56
   },
MQ2:{
CO: 0.000234,
LPG: 0.000312.
Smoke: 0.0002
   }
}

And you need to buzz the Buzzer when Temp value is above 45 and Smoke value is above 0.001
So you can use the code in this PR to extract both the values from the entire JSON and write the logic for Buzzer accordingly

@CLAassistant
Copy link

CLAassistant commented Apr 9, 2021

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@aentinger aentinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@aentinger aentinger merged commit ef9cb84 into arduino-libraries:master Nov 10, 2022
@per1234 per1234 added type: enhancement Proposed improvement topic: documentation Related to documentation for the project labels Nov 11, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
topic: documentation Related to documentation for the project type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants