-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"fruit": "Apple", | ||
"size": "Large", | ||
"color": "Red" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"color": "Red", "fruit": "Apple", "size": "Large"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
color: Red | ||
fruit: Apple | ||
size: Large |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#author: Shantanu Kumar Rahut | ||
#email: [email protected] | ||
|
||
import simplejson as json | ||
import yaml as yaml | ||
|
||
print("Loading json Data...") | ||
#opening json file in read mode | ||
f = open('example_1.json','r') | ||
print("Saving json Data...") | ||
#loading json data in a variable | ||
jsondata = json.load(f) | ||
print("Closing File...") | ||
#closing the file | ||
f.close() | ||
print("json Data Loading Finished...") | ||
|
||
|
||
#opening yaml file in write mode | ||
ff = open('example_2.yaml','w+') | ||
print("Data Dumping from json to yaml Started...") | ||
#dumping data from json to yaml | ||
yaml.dump(jsondata,ff,allow_unicode=True) | ||
print("Data Dumping from json to yaml Finished...") | ||
#closing file | ||
ff.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#author: Shantanu Kumar Rahut | ||
#email: [email protected] | ||
|
||
import simplejson as json | ||
import yaml as yaml | ||
|
||
print("Loading yaml Data...") | ||
#opening yaml file in read mode | ||
f = open('example_2.yaml','r') | ||
print("Saving yaml Data...") | ||
#loading yaml data in a variable | ||
yamldata = yaml.safe_load(f) | ||
print("Closing File...") | ||
#closing the file | ||
f.close() | ||
print("yaml Data Loading Finished...") | ||
|
||
|
||
#opening json file in write mode | ||
ff = open('example_2.json','w+') | ||
print("Data Dumping from yaml to json Started...") | ||
#dumping data from yaml to json | ||
json.dump(yamldata,ff, ensure_ascii=False) | ||
print("Data Dumping from yaml to json Finished...") | ||
#closing file | ||
ff.close() | ||
|
||
|
||
|
||
|
||
|