web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Unanswered

retrieving OkHttp json response data

(0) ShareShare
ReportReport
Posted on by 90

am using web service which is created in the Business central, I tried to get all json data using ODataV4 URL using OkHttp GET methos and successfulIy got OkHttp response, But when I tried to get jason element from from response in java code it is giving exception as JSONObject["Code"]  not found even thought that key is present in response obtained from GET method. Could anyone provide a way so I can successfully retrieve all key value pairs of JASON data.

Screenshot-_2800_123_2900_.png

Screenshot-_2800_124_2900_.png

I have the same question (0)
  • gert-jan.terschure Profile Picture
    206 on at

    What is the object you're trying to deserialize, please provide a small sample? If you're pulling an entity collection instead of a single entity, the result returned will look similar to below. This means that a property such as "Code" is not at the root element, but in root -> value  -> object -> code. My advise is to use the Gson library to deserialize the returned Json object, so you can work with it as if it's a regular Java object.

    {
        @odata.annotations: "This are the @odata. fields, like @odata.count",
        value: [
            { "Object 1" },
            { "Object 2" },
            { "Object n" }
        }
    ]
            
        

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,028 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,121 Super User 2026 Season 1

#3
Teagen Boll Profile Picture

Teagen Boll 669 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans