Questions tagged [convertto-json]
31 questions
0
votes
2 answers
Powershell JSON Building
I am having problems getting assembling this Json in Powershell
{
"totalCount": 1,
"list": [
{
"type": "ToggleLightingState",
"order": 1,
"delay": null,
"postDelay": null,
"name": "Toggle lighting state of light…

Broc Christensen
- 9
- 2
0
votes
1 answer
Powershell ConvertTo-Json adding many spaces between characters
I've got issue on following script. I am using latest PowerShell 7
Code:
$databasesArray = @('Zero','One','Two','Three')
$databasesDev = $databasesArray | ConvertTo-Json -Compress
Write-Host @databasesDev
Result:
[ " Z e r o " , " O n e " , " T…

Tomasz Maj
- 1,541
- 15
- 15
0
votes
1 answer
powershell out-file writing zero bytes
I am trying to export the SQL Server query results chunks in to .json file. Here I have large table around the 90GB I need to automate the script using the pagination approach.
The following Powershell script is generating within the For loop in c#…

sridharnetha
- 2,104
- 8
- 35
- 69
0
votes
1 answer
Convert CSV file to JSON file using PowerShell ignore scientific notation
I have .csv files containing long numbers. I used the following PowerShell script to convert from .csv file to .json. But the long numbers are importing as scientific notation.
How to force import long number from csv to json without converting to…

sridharnetha
- 2,104
- 8
- 35
- 69
0
votes
1 answer
How can I transform a pandas df to this kind of json structure?
Let's say I have a pandas df like this:
| name | color of clothing | age |occupation|
| John | yellow | 34 | janitor |
| Carl | red | 27 | doctor |
| Claire | green | 33 | teacher |
| Lisa | blue …

AzUser1
- 183
- 1
- 14
0
votes
1 answer
Is there a way in Jmeter JDBC request to convert "result variable" data into Json format?
I am storing Jmeter JDBC REquest data in result variable which come out in following format :
[[alt_id:535644, cd:A, cube:1.000, stat_dt:null, ts:9999-12-31T00:01]]
I tried the following to convert it to JSON but not successful :
def resl =…

DEVIL FF
- 3
- 2
0
votes
1 answer
Convert a Powershell-Object to JSON with sorting
I have a PSCustomObject in Powershell which I want to convert to JSON. The Key-Value-Pair should be under the "children" array. Can you help?
Powershell:
#PowershellObject
$BookmarkContainer = [PSCustomObject]@{
"roots" = @{
"other" =…

ciganfab
- 3
- 2
0
votes
1 answer
Converting Epoch Time to Human Readable Time in Powershell 'ConvertTo-Json' Outputs
Powershell automatically converts all the date-time fields to Epoch time when using 'ConvertTo-Json'. Is there a way to prevent this from happening or changing it back to human-readable date-time? For example, check some of the fields in the…

QuantAC
- 31
- 1
- 9
0
votes
3 answers
convert space separated list of names within a file to json formatted json file
I have a space separated list of names generated by a program, I need to convert this list to json. I can not change the program generating the file output. I need to convert the output in file names.txt to json.
example: file output is called…

Wiked0ne
- 3
- 1
0
votes
2 answers
Manipulate timestamps of JSON object
{
"logs": [
{
"timestamp": "20181216T14:36:12",
"description": "IP connectivity via interface ipmp1 has become degraded.",
"type": "alert",
…
0
votes
1 answer
Powershell convertto-json gives a bad format
Hello I'm trying to use convertto-json to create a json file from another output and save it but I'm getting a bad json format
Here is my function
$output.value | ForEach-Object {
"{"+"id"+':'+ $_.id+','+"outcome" +':'+…

Omar Bouattour
- 41
- 2
- 9
0
votes
1 answer
JsounUtils.fromJson -first letter is capital letter and JsonUtils will not map field with capital letter
I want to parse:
List resources =
Arrays.asList(JsonUtils.fromJson(json, new TypeReference() {}));
and in json one field begins with capital letter:
WebUrl instead of webUrl therefore this field is NULL.
How can I…

Matley
- 1,953
- 4
- 35
- 73
0
votes
1 answer
ConverTo-Json altering intended output
I have a psobject that is created from the JSON output of an Invoke-RestMethod. My intention is to change one value, convert back to JSON, then add back to the application REST API with another Invoke-RestMethod. I have done this several times in…

g2gsr
- 43
- 7
0
votes
1 answer
Extracting variables from calling the value- Getting Error message in condition
I am trying to do validation. checking the deployed values with the given values. I extract the vnet values from Azure resources using RestAPI method and convertto-json from Object because of vnet object is giving me empty object…

Sri
- 11
- 3
-1
votes
1 answer
Unable to assign output of command to $GITHUB_OUTPUT in github actions
This github action aims to convert the output of ls command into input [json] for the strategy matrix in github actions.
Below, workflow attempt fails on a UNIX github runner.
name: Convert LS Output to Strategy Matrix
on:
push:
branches:
-…

Ashar
- 2,942
- 10
- 58
- 122