GithubHelp home page GithubHelp logo

has_key? about arduinojson HOT 7 CLOSED

bblanchon avatar bblanchon commented on June 24, 2024
has_key?

from arduinojson.

Comments (7)

bblanchon avatar bblanchon commented on June 24, 2024

Both Generator::JsonObject and Parser::JsonObject have the following public method:

bool containsKey(const char* key);

which returns true if the key is present, and false if not.

from arduinojson.

MYeager1967 avatar MYeager1967 commented on June 24, 2024

I'll give this a look when I get back to my computer. If i can figure out
how to make it work, it will greatly ease my coding burden on this
project. Is there any full documentation on this library? I like it's
footprint over aJSON...
On Aug 25, 2014 2:39 AM, "Benoît Blanchon" [email protected] wrote:

Both Generator::JsonObject and Parser::JsonObject have the following
public method:

bool containsKey(const char* key);

which returns true if the key is present, and false if not.


Reply to this email directly or view it on GitHub
#12 (comment)
.

from arduinojson.

bblanchon avatar bblanchon commented on June 24, 2024

Please have a look at the README files:
https://github.com/bblanchon/ArduinoJson/blob/master/README.md
https://github.com/bblanchon/ArduinoJson/blob/master/JsonGenerator/README.md
https://github.com/bblanchon/ArduinoJson/blob/master/JsonParser/README.md

from arduinojson.

MYeager1967 avatar MYeager1967 commented on June 24, 2024

I believe I have it figured out. I haven’t actually run the code yet but the line:

bool containsKey(const char* Pool);

seems to pass the verify built into the IDE. No guarantee it will do what I want it to do though. Is it possible to check for a nested key or do I need to check for the first key (Pool in this case) and then check for subkeys under it? I realize this is an Arduino library and code space is a premium. I’m just ecstatic to have a library to handle JSON that doesn’t eat up too much memory.

Mike

From: Benoît Blanchon [mailto:[email protected]]
Sent: Monday, August 25, 2014 2:39 AM
To: bblanchon/ArduinoJson
Cc: MYeager1967
Subject: Re: [ArduinoJson] has_key? (#12)

Both Generator::JsonObject and Parser::JsonObject have the following public method:

bool containsKey(const char* key);

which returns true if the key is present, and false if not.


Reply to this email directly or view it on GitHub #12 (comment) .

from arduinojson.

MYeager1967 avatar MYeager1967 commented on June 24, 2024

Ok. It didn’t do what I expected….

From: Benoît Blanchon [mailto:[email protected]]
Sent: Monday, August 25, 2014 2:39 AM
To: bblanchon/ArduinoJson
Cc: MYeager1967
Subject: Re: [ArduinoJson] has_key? (#12)

Both Generator::JsonObject and Parser::JsonObject have the following public method:

bool containsKey(const char* key);

which returns true if the key is present, and false if not.


Reply to this email directly or view it on GitHub #12 (comment) .

from arduinojson.

MYeager1967 avatar MYeager1967 commented on June 24, 2024

Ok. With a little time to think and pull my head out of my ass, I figured it out. Thank you for not replying too quick with an answer… I’d still like to know if it’s possible to check for nested keys without testing at multiple levels. Like I said, if not, it’s no big deal. My life is already easier….

From: Benoît Blanchon [mailto:[email protected]]
Sent: Monday, August 25, 2014 9:39 AM
To: bblanchon/ArduinoJson
Cc: MYeager1967
Subject: Re: [ArduinoJson] has_key? (#12)

Please have a look at the README files:
https://github.com/bblanchon/ArduinoJson/blob/master/README.md
https://github.com/bblanchon/ArduinoJson/blob/master/JsonGenerator/README.md
https://github.com/bblanchon/ArduinoJson/blob/master/JsonParser/README.md


Reply to this email directly or view it on GitHub #12 (comment) .

from arduinojson.

bblanchon avatar bblanchon commented on June 24, 2024

You could just try to get the value and see if it exists.
Like this:

json["key1"]["key2"].success()

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.