๐จโ๐ป Indie maker
๐ Building volt.fm (2M+ users)
๐ต Sold pikaso.me, postsheet.com and rippd.app
Follow me on Twitter: twitter.com/soheilpro
Displays JSON files in a flat format.
License: MIT License
๐จโ๐ป Indie maker
๐ Building volt.fm (2M+ users)
๐ต Sold pikaso.me, postsheet.com and rippd.app
Follow me on Twitter: twitter.com/soheilpro
As the title says
eg. will work with {"test":123} but not {test:123}
disclaimer: I only tried with standard input
to reproduce:
(warning: 180mb json file)
curl "https://github.com/zemirco/sf-city-lots-json/blob/master/citylots.json" > citylots.json
cat citylots.json | catj # <- out of mem.
catj citylots.json # <- also out of mem.
I agree this format is easier to read. Nice work!
I noticed what I think is a problem though. Using this example event from AWS, I am noticing that keys with hyphen are being rendered like arrays in square brackets. I don't pretend to be an expert on the JSON spec but I don't think that is right.
{
"version": "0",
"id": "CWE-event-id",
"detail-type": "CodePipeline Action Execution State Change",
"source": "aws.codepipeline",
"account": "123456789012",
"time": "2017-04-22T03:31:47Z",
"region": "us-east-1",
"resources": [
"arn:aws:codepipeline:us-east-1:123456789012:pipeline:myPipeline"
],
"detail": {
"pipeline": "myPipeline",
"version": 1,
"execution-id": "01234567-0123-0123-0123-012345678901",
"stage": "Prod",
"action": "myAction",
"state": "STARTED",
"region":"us-west-2",
"type": {
"owner": "AWS",
"category": "Deploy",
"provider": "CodeDeploy",
"version": 1
}
}
}
.version = "0"
.id = "CWE-event-id"
.["detail-type"] = "CodePipeline Action Execution State Change"
.source = "aws.codepipeline"
.account = "123456789012"
.time = "2017-04-22T03:31:47Z"
.region = "us-east-1"
.resources[0] = "arn:aws:codepipeline:us-east-1:123456789012:pipeline:myPipeline"
.detail.pipeline = "myPipeline"
.detail.version = 1
.detail["execution-id"] = "01234567-0123-0123-0123-012345678901"
.detail.stage = "Prod"
.detail.action = "myAction"
.detail.state = "STARTED"
.detail.region = "us-west-2"
.detail.type.owner = "AWS"
.detail.type.category = "Deploy"
.detail.type.provider = "CodeDeploy"
.detail.type.version = 1
Allow generation of json file from the .dot.brackets[0]: colon
syntax.
Reasoning:
It would be then possible to use this as a basis for a plugin to config editors.
copy pasted from : https://news.ycombinator.com/item?id=20246727
#!/usr/bin/jq -jf
jq -j '
[
[
paths(scalars)
| map(
if type == "number"
then "[" + tostring + "]"
else "." + .
end
) | join("")
],
[
.. | select(scalars) | @json
]
]
| transpose
| map(join(" = ") + "\n")
| join("")
'
(just so that if somebody come accross your great project, and wants to do something equivalent without needing npm )
Thanks for catj
!
Will it be possible to use it a node module sometime in the future ?
Cheers !
Handy tool. What do you think about adding the ability to output the JSON representation when given the flat representation?
Could you add to the readme, or just discuss hear how this utility differs with https://github.com/tomnomnom/gron, and why you might choose one over the other?
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.