Questions tagged [convertfrom-json]

23 questions
13
votes
3 answers

ConvertTo-Json and ConvertFrom-Json with special characters

I have a file containing some properties which value of some of them contains escape characters, for example some Urls and Regex patterns. When reading the content and converting back to the json, with or without unescaping, the content is not…
Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
4
votes
1 answer

ConvertFrom-Json returns "Cannot process argument because the value of argument "name" is not valid."

I face a problem when trying to convert a valid json-file into powershell-internal representation with the following code snippet: [string]$changes = Get-Content -Path "C:\some\directory\with\file.json" [PSCustomObject]$changes = ConvertFrom-Json…
Daniel
  • 578
  • 6
  • 18
2
votes
1 answer

Powershell Access Nested Object in JSON after using ConvertFrom-Json

I've been able to parse some JSON succesfully up to a point but cannot access a specific object: My overall code: $myFile = Get-Content -Raw -Path UKStore.json | ConvertFrom-Json $counter = 0 foreach ($link in $myFile.links) { Write-Host…
Nealbo
  • 529
  • 4
  • 20
2
votes
1 answer

Powershell showing wrong output for JSON-object and ADDRESS-property

I am currently struggling to convert a JSON-string into an array of objects and to GENERALLY handle the properties/attributes of each object. Here is a simple demo, that shows that e.g. the attribute "address" seems to be a bit special: cls $json =…
Carsten
  • 1,612
  • 14
  • 21
2
votes
2 answers

Why is PowerShell applying the predicate of a `Where` to an empty list

If I run this in PowerShell, I expect to see the output 0 (zero): Set-StrictMode -Version Latest $x = "[]" | ConvertFrom-Json | Where { $_.name -eq "Baz" } Write-Host $x.Count Instead, I get this error: The property 'name' cannot be found on this…
ledneb
  • 1,371
  • 1
  • 13
  • 25
1
vote
1 answer

Convertfrom-JSON assistance

I am trying to put together a script to create a Microsoft Team from a JSON file. I am trying to understand Convertfrom-JSON and how I can pipe the object into creating a new team with channels and users. I can view the object by entering in…
Derek
  • 37
  • 5
1
vote
1 answer

Powershell ConvertFrom-Json omitting Depth > 1

Given this…
Dave
  • 378
  • 4
  • 14
1
vote
1 answer

Powershell ConvertFrom-Json: Selecting Value of Nested Array Based on Property Name

I have a json file that I'm trying to export to csv using powershell, but I only need certain nested values. It looks like the following: [ { "ItemName": "A", "ItemID": "I001", "ItemDate": "2021-03-01", "ItemValue":…
wd510
  • 25
  • 5
1
vote
2 answers

How to read json file into java with jackson library?

I want to read this simple JSONfile with java jackson library(I'm new to JSON). Coud you please tell to me what i do wrong?I created class or JSON object wrongly or this metod of convertion JSON object to Java is wrong, thanks Edit now i get set of…
user14363418
1
vote
1 answer

Powershell ConvertFrom-Json Hebrew --> Question marks

I'm trying to convert Powershell Variable from Json and I get question marks instead of Hebrew. As far as i know there is no encoding parameter for ConvertFrom-Json, any ideas how can i pass the hebrew? take a look at this word: מחילמ PS D:\wa2>…
Moshiko
  • 29
  • 5
1
vote
1 answer

Displaying Data to a certain Depth When Using Convertfrom-json

Currently i'm attempting to create a script to convert my json files to csv files. At the moment I'm receiving most of the data, but the issue i'm having is expanding out the "glyphs" field to add that data into the csv as well. Below is an example…
Melon Man
  • 165
  • 1
  • 13
0
votes
1 answer

Powershell: Issues converting curl GET response to array

I'm unable to convert a GET response received with curl in Powershell to an array using ConvertFrom-Json. The request is pulling a list of users from a webapp. A couple JSON validators say the JSON is valid (FWIW). The results look like the data…
gunnys
  • 15
  • 2
0
votes
0 answers

Parse complex json and convert into CSV in Powershell

I am new to Powershell. I have a gz zip file which consists one json will have json data in the below format. { "results": [{ "_id": "1", "AccountPartyRelationshipList": { "AccountPartyRelationship": [{ "PartyIdValue":…
Mohan.V
  • 141
  • 1
  • 1
  • 10
0
votes
0 answers

Powershell command ConvertFrom-Json gives empty objects

I want to update the package.json file in my project. I'm doing this by using the ConvertFrom-JSON command of Powershell (version 7.2.5). But when it is converted from JSON to objects. The nested (complex) objects are empty. How can I prevent…
Gert Rikkers
  • 21
  • 1
  • 5
0
votes
1 answer

Powershell ConvertFrom-Json accessing json value

I have a json file that I'd like to convert to csv. However, the actual value is nested inside reading key that I need to access. It returns System.Object[] in which I know I have to access this, but I don't know how. the following is the…
sutan
  • 404
  • 3
  • 14
1
2