|
1 |
| -# json-token-replace |
2 |
| -Replace token string {{hello}} in json with value from another json where key is token {"hello":"bye"} |
| 1 | +<p align="center"><a href="https://www.npmjs.com/package/json-token-replace" alt="Logo"><img src="https://ptkdev.it/img/github/json-token-replace.png"></a></p> |
| 2 | + |
| 3 | +<p align="center"><h1 align="center">json-token-replace</h1></p> |
| 4 | + |
| 5 | +<p align="center"><a href="#" alt="License"><img src="https://img.shields.io/badge/license-GLPv3-brightgreen.svg"></a> |
| 6 | +<a href="https://github.com/ptkdev/json-token-replace/releases" alt="Version"><img src="https://img.shields.io/badge/version-v1.0.0-lightgrey.svg"></a> |
| 7 | +<a href="https://slack.ptkdev.io" alt="Slack Chat"><img src="https://img.shields.io/badge/chat%20on-slack-orange.svg"></a> |
| 8 | +<a href="http://blog.ptkdev.io" alt="Blog"><img src="https://img.shields.io/badge/blog-medium-2AE176.svg"></a> |
| 9 | +<a href="https://twitter.com/ptkdevio" alt="Twitter"><img src="https://img.shields.io/badge/twitter-ptkdevio-2AA3EF.svg"></a> |
| 10 | +< a href= "mailto:[email protected]" alt= "Support: [email protected]">< img src= "https://img.shields.io/badge/[email protected]"></ a></ p> |
| 11 | +<p align="center"><a href="http://patreon.ptkdev.io" alt="Patreon Backer"><img src="https://img.shields.io/badge/donate-patreon-F87668.svg"></a> <a href="http://paypal.ptkdev.io" alt="Paypale Donate"><img src="https://img.shields.io/badge/donate-paypal-46AFE0.svg"></a></p> |
| 12 | + |
| 13 | +## What does it do |
| 14 | +Replace the token string {{hello}} in json with value from another json where key is token {"hello":"bye"} |
| 15 | + |
| 16 | +#### Example: |
| 17 | +Json with tokens: |
| 18 | +`{ "john":"Alex" }` |
| 19 | + |
| 20 | +Json: |
| 21 | +`{ "text": "hello {{john}}"}` |
| 22 | + |
| 23 | +Output: |
| 24 | +`{ "text": "hello Alex"}` |
| 25 | + |
| 26 | +## Features |
| 27 | +* [✓] Easy to use |
| 28 | + |
| 29 | +## Fast setup |
| 30 | +1. Add dependencies on `package.json` |
| 31 | +``` |
| 32 | +"dependencies": { |
| 33 | + "json-token-replace": "^1.0.0", |
| 34 | +} |
| 35 | +``` |
| 36 | +2. In your code: |
| 37 | +``` |
| 38 | +const Jtr = require("json-token-replace"); |
| 39 | +const jtr = new Jtr(); |
| 40 | +
|
| 41 | +let json_output = jtr.replace("./json_with_tokens.json", "./json.json"); |
| 42 | +``` |
| 43 | +3. If work add star :star: at this project :heart: |
| 44 | +4. If you want help me: <b><a href="http://paypal.ptkdev.io">donate on paypal</a></b> or become a <b><a href="http://patreon.ptkdev.io">backer on patreon</a></b>. |
| 45 | + |
| 46 | +For advanced configuration see [INSTALL.md](https://github.com/ptkdev/json-token-replace/blob/master/INSTALL.md). |
| 47 | + |
| 48 | +<h1>License</h1> |
| 49 | + |
| 50 | +GNU GENERAL PUBLIC LICENSE |
| 51 | + |
| 52 | +Copyright (c) 2018 Patryk Rzucidło (PTKDev) |
0 commit comments