Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

I need to append new JSON to an existing file

$
0
0

I have a JSON file 

$jsonfile= gc C:\Users\asif\data.json

write-Host $jsonfile

{
    "buildDate":  "2017-08-16",
    "version":  "v1.2.0"
}

how do I append the below value to above?

$jsonContent = [PSCustomObject]@{
    'buildDate'   = '2018-08-20'
    'version' = 'v2.1.5'
}

I need the result like below saved to $jsonfile

{
    "buildDate":  "2017-08-16",
    "version":  "v1.2.0"
},

{

 'buildDate'   = '2018-08-20'
    'version' = 'v2.1.5'

}

Thanks in advance


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>