Questions tagged [convertfrom-json]

23 questions
0
votes
2 answers

Fetching JSON with PowerShell - How do I fetch all keys under multiple arrays?

I'm trying to build a json file that'll be used in our diverse scripts to fetch our server details. The same script will be used across all our environments that contains multiple products and components. Here's the kind of json file I'm working…
0
votes
2 answers

Invoke-WebRequest content ConvertFrom-Json: Conversion from JSON failed with error: Unexpected character encountered while parsing value (CR;LF)

I successfully sent an webrequest to a Website and got a responde: $Uri = "https://URLXYZ" $Method = "POST" $Header = @{ "Accept" = "*/*"; "Connection" = "keep-alive"; "Accept-Encoding" = "gzip, deflate, br"; "Content-Type" =…
kaiaschulz
  • 35
  • 1
  • 6
0
votes
0 answers

Powershell exporting data from nested JSON

I need help with looping through the following JSON file and pull in all the attributes under "snapshot_groupSnapshotChildren""entitySnapshot_properties" For example the "Test", "Guacamole" and the "Heartbeat on Guacamole" are dynamic and the depth…
0
votes
1 answer

PowerShell: Get Key and Value from Json

I have the following Json: { "variable1" : "variable2" } I won't know what the values for variable1 and variable2 are. I need to get them from the Json, presumably using two separate commands that use ConvertFrom-Json in some way. They should…
Stephen Walsh
  • 815
  • 4
  • 18
  • 34
0
votes
1 answer

How to use export-CSV when your json file contains key-VALUES pairs instead of key-value pair?

I am using powershell to try and convert Json to csv. I have the bellow Json file that I would like to convert to CSV. But for some reason when I run my code bellow: (Get-Content $pathToJsonFile -Raw | ConvertFrom-Json) | Select * | export-CSV…
Phantom7
  • 27
  • 4
0
votes
1 answer

Flatting nested .json-files that start with "[" when | ConvertFrom-Json gives the wrong output

I am trying to get a format of the .json file that gives a correct output when using | ConvertFrom-Json. I tend to loose a lot of information, and the returned object does not work as an input to the desired function to flatten the .json file. I…
esr
  • 1
0
votes
1 answer

Retrieve value from Json object with field having dots and hyphen in powershell

I want to retrieve value of a field present in json object. The filed name has dots and hyphen. For eg: $json = @" { "Stuffs": { "Name.new-name": "Darts", "Type": "Fun Stuff" } } "@ How can I get the value Darts? I…
PREETI BANSAL
  • 185
  • 2
  • 12
-1
votes
3 answers

Explode JSON array into rows

I have a dataframe which has 2 columns" "ID" and "input_array" (values are JSON arrays). ID input_array 1 [ {“A”:300, “B”:400}, { “A”:500,”B”: 600} ] 2 [ {“A”: 800, “B”: 900} ] Output that I need: ID A B 1 300 400 1 500 600 2 …
1
2