Reputation: 737
I use a powershell script to get JSON Information from a webinterdace. Actually i store the JSON Information from there into a file before i use JQ 1.5 (under Windows 10) to transform the json into a format that i can upload into a database. But since i use jq in the same powershell enviroment, i think i can avoid that redirection and work directly with the json text (with a variable or with the json text direct in the jq command). I checked the Manual but found no clear answer on that question (for me). I found in the Manual the --argjson command that Looks like that i need. But the Manual is not clear how i define the variable under Windows/powershell.
Regards Timo
Upvotes: 0
Views: 2113
Reputation: 737
Sorry if the question is confusing. I found a way to work with variables directly on the commandline, e.g:
$variable | C:\jq.exe [Filter]
There was no Explanation in the JQ Manual how to pass json text directly on the commandshell to jq. But i found it. Thanks for your help.
Regards Timo
Upvotes: 2
Reputation: 116880
You could use the ConvertFrom-Json command to convert any piece of JSON directly into a PowerShell object.
Upvotes: 1