Hi @Hitender Singh ,
What's the type of parameter $a
? Is it a string? If so you need to convert it to Stream type to make it work. Below is my demo code for you:
$a='[
{
"test": "A",
"id": 1
},
{
"test": "B",
"id": 2
},
{
"test": "C",
"id": 3
}
]'
$stream = [IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($a))
Add-pnpfile -Folder "Shared Documents" -FileName "test.json" -Stream $stream -Values @{Modified="1/5/2021"}
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.