choovick / ps-jsonutils Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
Feature request.
Allow a string array for input instead of only 1 string. Would require a foreach loop.
@choovick, I've done a code review and feel like there aren't any issues that i would say prevent it from being ready for a v1.0 release, Are there any things that you'd recommend I look at or do before I mark this as v1 ready?
At present, JsonUtils will count these two input objects as being different.
Get-JsonDifference '{"a":[1,2,3]}' '{"a":[1,3,2]}'
Is that what you'd expect? Or would you like to see it ignore array ordering?
Run this code:
Convert-JsonKeysToSorted -JsonString '{"b":1,"1":[{"b":null,"a":1}]}'
See that the output is:
{
"1": {
"a": 1,
"b": null
},
"b": 1
}
Instead of expected:
{
"1": [
{
"a": 1,
"b": null
}
],
"b": 1
}
Feature request
Allow ConvertTo-KeysSortedJSONString to accept pipeline input for string to convert. Would require adding ValueByPipeline parameter binding and start/process/end blocks.
This is only a minor pet-peeve, but generally, ConvertTo-* cmdlets serialize data from powershell objects into their noun specification. ConvertTo-Html, ConvertTo-Csv, etc. Similar for ConvertFrom-* cmdlets. I would suggest using a verb that represents changing data from 1 form to another, where neither is a native powershell object. Good list to be found on this MS page. I personally like Convert:
Changes the data from one representation to another
An example: Convert-Path changes a path from a string to a string. Very similar to this function.
A possible name then could be Convert-JsonToSortedKeys
or something.
You'd want to use the alias
parameter decorator to not break existing functions that rely on this name. You may want to add a warning notice when people do use the old cmdlet name though. Definitely wouldn't want to remove the alias prior to v1.0.0, but you may possibly want to never remove that alias.
Happy to submit a PR if you're open to it.
> Get-JsonDifference -FromJsonString '{"hat": {"rabbit": "Fluffy"}}' `
>> -ToJsonString '{"hat": {"magic words to make the rabbit vanish": "abbacadabra"}}'
{
"Added": {
"hat": {
"magic words to make the rabbit vanish": "abbacadabra"
}
},
"Changed": {},
"ChangedOriginals": {},
"Removed": {},
"NotChanged": {},
"New": {
"hat": {
"magic words to make the rabbit vanish": "abbacadabra"
}
}
}
Feature request
Since ConvertTo-KeysSortedJSONString already does a ConvertFrom-Json, this should be easy functionality to add. Could even do it via a transform if someone really wants to :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.