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

Community site session details

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

Replace a value in Json file

(1) ShareShare
ReportReport
Posted on by 16
Hi all,
I'm trying to replace a value in a Json file, but I don't find any example or documentation for AL Language. I've the following structure file:
 
{ /codeunitId/: 18121808,/functionName/ : /PrintDocMaya/,/parmInput/: [{/name/: /pDocumentType/,/value/: /1/},{/name/: /pDocumentNo/,/value/: /102046/},{/name/: /pFilePath/,/value/: /C:////Temp/////}],/parmOutput/: [{/name/: /Return/,/value/:/0/}]}
 
I would like to replace value /0/ from parmOutput for the element with name /Return/. How could this be done?
 
Thank you for your kindly replies.
 
DZ
I have the same question (0)
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,348 Super User 2025 Season 2 on at
    Replace a value in Json file
    Hi dzaniboni
     
    I hope this can help you and give you some hints.
     
     
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • dzaniboni Profile Picture
    16 on at
    Replace a value in Json file
    Hi Mohamed,
    thank you for your reply but I'm able to create (from 0) or read a Json file. What I want is to know how to replace or modify an existing Json file (single values or properties).
  • Suggested answer
    Gerardo Rentería García Profile Picture
    23,590 Most Valuable Professional on at
    Replace a value in Json file
    Hi
    In systemapplication is this code,  i hope this can help you. 
    BR
    Gerardo
  • dzaniboni Profile Picture
    16 on at
    Replace a value in Json file
    I develop this solution:
    • create new Json Object for the section of the original Json object that I want to replace.
    • Create new Json Array to store in a Json array the new results for the outputParm section.
    • Add in the new Json Object the new keys and values
    • Add the new Json Object in the Json Array
    • Replace the Json array for the specific key (that's an array)
     
    Below the code:
     
            OutputJObject.Add('name', 'Return');
            OutputJObject.Add('value', O_DocFileName);
            OutputArray.Add(OutputJObject);
            JObject.Replace('parmOutput', OutputArray);
     
     
    Hope this you can help.
     
    DZ
     
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 2,762

#2
Sumit Singh Profile Picture

Sumit Singh 2,573

#3
YUN ZHU Profile Picture

YUN ZHU 1,930 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans