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 8401447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:48:32+00:00 2026-06-09T21:48:32+00:00

I have been searching quite a while now for how to read a nested

  • 0

I have been searching quite a while now for how to read a nested JSON with C++ Builder XE2 TJSONObject.

There are a few examples in Delphi but they use the TJSONValue object, but in the C++ version this class has a pure virtual function and can not be created.

Some example JSON:

{
  "totalHits": 4170,
  "totalCount": 4170,
  "startIndex": 0,
  "adverts": [
    {
      "Id": "14380005",
      "companyInfo": {
        "companyName": "Clarion Hotel Sign",
        "orgNumber": "5564660107",
        "companyText": "hotell"
      },
      "address": {
        "streetName": "Street race 2",
        "postCode": "101 26",
        "postArea": "MY AREA",
        "postBox": "Box 310"
      },
      "homepage": "www.mypage.net"
    }
  ]
}

The whole JSON is stored in the JSON object, trust me, it’s in there 🙂

TJSONObject *JSON = new TJSONObject;

I have no problem to get the value for totalHits and totalCount, but how do I get the "companyName" value?!?

Thanks

  • 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-06-09T21:48:34+00:00Added an answer on June 9, 2026 at 9:48 pm

    I post this belated answer for someone else who meets the same problems in the future….

    TJSONArray* jArray = (TJSONArray* )JSON->Get("adverts")->JsonValue;
    TJSONObject* jCompanyInfo = (TJSONObject*)((TJSONObject*)jArray->Get(0))
           ->Get("companyInfo")->JsonValue);
    String companyName =  jCompanyInfo->Get("companyName")->JsonValue->Value());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been searching for quite a while now but i am unable to
I have been searching about this subject now for quite a few days. And
I have been searching for a solution for quite a while now and couldn't
I have been searching the web for an answer now for quite a while,
I have been searching for quite a bit now but I have never been
I have been searching for this for quite a while and couldn't find a
I have been searching around for quite a while on ways to do this,
I have been searching this for quite a while but couldn't find a solution
I have been searching the net for quite sometime now on how to extend
I have been searching for an answer and trying out stuff for days now

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.