# flow-json-component

> Component designed using Flow SDK to convert text to JSON or to convert JSON to text

Latest version **0.3.4** (published 2019-06-08) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install flow-json-component
pnpm add flow-json-component
yarn add flow-json-component
bun add flow-json-component
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.4 |
| Published | 2019-06-08 |
| First published | 2018-10-08 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 29.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Hackerbay Inc. |
| Maintainers | hackerbayadmin |
| Keywords | json, flow |

## Links

- npm: https://www.npmjs.com/package/flow-json-component
- Repository: https://github.com/FlowAppPlatform/flow-json-component
- Homepage: https://github.com/FlowAppPlatform/flow-json-component#readme
- Issues: https://github.com/FlowAppPlatform/flow-json-component/issues
- npm.io page: https://npm.io/package/flow-json-component

## Dependencies (1)

- [flow-platform-sdk](https://npm.io/package/flow-platform-sdk.md) ^1.3.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.3.4 (latest) — 2019-06-08
- 0.3.2 — 2019-03-10
- 0.3.0 — 2019-02-15
- 0.2.8 — 2018-12-26
- 1.0.10 — 2018-10-08

## README

# Flow Json component
The component converts text to JSON and JSON to text and is designed using Flow SDK.

*To get started, install the package in your NodeJS project*

```
npm i flow-json-component --save
```

*Use the component as below*

```javascript
// require the component
const Component = require('flow-json-component');
```

*To change text to json*

```javascript
// create instance of the toJSON component
const component = new Component.toJSON();

// provide text to change to json
component.getProperty('Text').data = { name: "Allan Wise" };
```

*To change json to text*

```javascript
// create instance of the fromJSON component
const component = new Component.fromJSON();

// provide json to change to text
component.getProperty('Text').data = '{"shape":"circle"}';
```

*Listen in for port emit events*
```javascript
component.getPort('Success').onEmit(function(){
  // task succesfully ran
  // the result can be accessed through the 'Data' property of the port
  let result = component.getPort('Success').getProperty('Data').data;
});

component.getPort('Error').onEmit(function(){
  // an error occured
  // the actual error can be accessed through the 'Data' property of the port
  let err = component.getPort('Error').getProperty('Data').data;
});
```

*Execute the component*
```javascript
// add the component to a graph before executing it
const Graph = require('flow-platform-sdk').Graph;
new Graph("graph-1").addComponent(component);

component.execute();
```

#### Conclusion

And that's the Flow Json component.

---
_Source: https://npm.io/package/flow-json-component · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
