Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7682179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:30:29+00:00 2026-05-31T18:30:29+00:00

Im using jsoncpp , its great but when i need to check if json

  • 0

Im using jsoncpp , its great but when i need to check if json structure contains tag
when i do it with :

UserRoot0["error"].isNull()

its throws me assert from json_value.cpp line 1025

JSON_ASSERT( type_ == nullValue  ||  type_ == objectValue );

i want to check if response im getting is from this type:

{
    "error" : {
        "message" : "Error validating application.",
        "type" : "OAuthException",
        "code" : 190
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T18:30:30+00:00Added an answer on May 31, 2026 at 6:30 pm

    The [] operator is only valid for JsonValue objects that are of type Object or null. All others (Int, Bool, Array, etc.) will assert.

    If your UserRoot0 object is an Array or some other non-Object type, you have some more work to do (like iterating into sub-nodes) to find your target node that may or may not contain the error. Print UserRoot0.toStyledString() to see what your JSON looks like, and make sure it looks like a JSON Object (see json.org for a nice overview of what that is).

    A “ToDo” comment at the top of the json_value.cpp source file (where JSON_ASSERT is defined) implies that the developers may be planning more robust error handling instead of these asserts in future versions, but in the meantime, you can check yourself, like this:

    if(UserRoot0.isObject() && UserRoot0.isMember("error"))
        // Process error node
    else
        // This node isn't an Object node or doesn't contain the "error" key
    

    The isMember() check will also assert for non-Object nodes, so be sure to check isObject() before checking isMember() if UserRoot0 isn’t guaranteed to be an Object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am parsing json data using JsonCpp . I don't really need to understand
I'm using JsonCpp to parse JSON in C++. e.g. Json::Reader r; std::stringstream ss; ss
I am using Jsoncpp to parse json-formats for c++. I do not understand how
I am using Jsoncpp to write a Json::value to a string using the Json::FastWriter.
Using C#, I need a class called User that has a username, password, active
Using the navigator.geolocation object in JavaScript. Trying to establish accurate ranges, but wondering exactly
using a binary search tree I need to add to a vector all int
I have recently compiled the SVN version of JSONCPP using the VS71 makefiles. It
How can I link jsoncpp with a C++ program using g++? I tried: g++
Using Xcode4.2.1, with a basic PhoneGap template based app. (I say template, but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.