https://github.com/adaptant-labs/jsonwrap
A simple API and CLI app for JSON object nesting and HTTP endpoint forwarding
https://github.com/adaptant-labs/jsonwrap
cli-app golang-application golang-library golang-tools http-requests json json-wrapper
Last synced: 3 months ago
JSON representation
A simple API and CLI app for JSON object nesting and HTTP endpoint forwarding
- Host: GitHub
- URL: https://github.com/adaptant-labs/jsonwrap
- Owner: adaptant-labs
- License: apache-2.0
- Created: 2019-12-05T13:00:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-05T21:24:00.000Z (over 5 years ago)
- Last Synced: 2025-01-30T12:28:07.101Z (4 months ago)
- Topics: cli-app, golang-application, golang-library, golang-tools, http-requests, json, json-wrapper
- Language: Go
- Size: 10.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JSONWrap
[](http://godoc.org/github.com/adaptant-labs/jsonwrap)
[](https://travis-ci.com/adaptant-labs/jsonwrap)
[](https://goreportcard.com/report/github.com/adaptant-labs/jsonwrap)`jsonwrap` provides a simple API for JSON object nesting in Go.
A convenience CLI app implementing the API and capable of forwarding the wrapped JSON to a remote HTTP endpoint is
also provided.## CLI Quick Start
Using the default Consul service catalog as an example:
```shell script
$ curl -X GET localhost:8500/v1/catalog/services
{
"consul": []
}
```This can be nested under as many levels as needed, simply repeat the `--wrap` flag for each level:
```shell script
$ curl -s -X GET localhost:8500/v1/catalog/services | jsonwrap --wrap services --wrap consul
{
"consul": {
"services": {
"consul": []
}
}
}
```The wrapped output can, in turn, be forwarded to a remote HTTP endpoint:
```shell script
$ curl -s -X GET localhost:8500/v1/catalog/services | \
jsonwrap --wrap services --wrap consul --method PUT --target http://localhost:8181/v1/data
```## Usage
```shell script
$ jsonwrap --help
NAME:
jsonwrap - CLI for JSON object nesting and HTTP forwardingUSAGE:
[global options] command [command options]VERSION:
0.0.1DESCRIPTION:
A convenience CLI tool for nesting JSON objects and forwarding the result to a remote HTTP endpointAUTHOR:
Adaptant LabsCOMMANDS:
help, h Shows a list of commands or help for one commandGLOBAL OPTIONS:
--target value Target URL to forward wrapped JSON to
--method value Forwarding method to use (default: "POST")
--wrap value Name of object to nest under
--help, -h show help
--version, -v print the versionCOPYRIGHT:
(c) 2019 Adaptant Solutions AG
```## API Documentation
Online API documentation is provided through `godoc`, and can be accessed directly on the
[package entry](https://godoc.org/github.com/adaptant-labs/jsonwrap) in the godoc package repository.## Features and bugs
Please file feature requests and bugs at the [issue tracker][tracker].
[tracker]: https://github.com/adaptant-labs/jsonwrap/issues
## License
Licensed under the terms of the Apache 2.0 license, the full version of which can be found in the
[LICENSE](https://raw.githubusercontent.com/adaptant-labs/jsonwrap/master/LICENSE) file included in the
distribution.