Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

JsonObject with Square Brackets

Posted on by 40

I'm working with an integration where i have to make some API-calls, and some of the filters on the API uses square brackets around their values (see picture)

pastedimage1673263317914v2.png

My problem is that i add this value to the JsonObject, naturally as a string or Code datatype - but once the parameter is surrounded by quotation, it stops working.
If i send "[12230001]" with quotation outside of the brackets, the API returns an error. How can i bypass this? Is there any other datatype that supports brackets that would not be wrapped in quotationmarks in a JsonObject?

  • RE: JsonObject with Square Brackets

    Perfect, this is just what i wanted. Thanks for the replies!

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: JsonObject with Square Brackets

    You should use the Json array data type as documented here:

    learn.microsoft.com/.../jsonarray-data-type

  • RE: JsonObject with Square Brackets

    You are right, but how do i build a variable for the jsonObject, that takes the brackets [ ] without it being a string/code/text?

    This is what i have currently
    pastedimage1673860446011v1.png

    This ends up as "[ some number ]"
    Any tips on how it can end up as ["number"] with the brackets on the outside?

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: JsonObject with Square Brackets

    Square brackets in JSON means an array object, so I think you need to pass the data as follows:

    "projectIdFilter": ["12230001"]

  • Suggested answer
    Andy Sather Profile Picture
    Andy Sather on at
    RE: JsonObject with Square Brackets

    Hello  - We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    I will open this up to the community in case they have something to add.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans