Skip to content

Commit 536ab60

Browse files
author
Vinit Kumar
committed
update docs to add json string to xml support
1 parent f1ae754 commit 536ab60

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

readme.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@ pip3 install json2xml
1313

1414
### Usage
1515

16-
#### Command Line
16+
### Command Line
1717

1818
```
1919
python -m src.cli --file="examples/example.json"
2020
python -m src.cli --url="https://coderwall.com/vinitcool76.json"
21+
python -m src.cli --data '{"login":"mojombo","id":1,"avatar_url":"https://avatars0.githubusercontent.com/u/1?v=4"}'
2122
```
2223

23-
#### Inline in Code
24+
### Inline in Code
2425

25-
- From a file
26+
#### From a file
2627

2728
```python
2829
from src.json2xml import Json2xml
@@ -31,7 +32,7 @@ data_object = Json2xml(data)
3132
data_object.json2xml() #xml output
3233
```
3334

34-
- From an URL
35+
#### From an URL
3536

3637
```python
3738
from src.json2xml import Json2xml
@@ -40,6 +41,14 @@ data_object = Json2xml(data)
4041
data_object.json2xml() #xml output
4142
```
4243

44+
#### From JSON string
45+
46+
```python
47+
from src.json2xml import Json2xml
48+
data = Json2xml.fromstring('{"login":"mojombo","id":1,"avatar_url":"https://avatars0.githubusercontent.com/u/1?v=4"}').data
49+
data_object = Json2xml(data)
50+
data_object.json2xml() #xml output
51+
```
4352

4453
### Bugs, features
4554

0 commit comments

Comments
 (0)