diff --git a/README.md b/README.md index 9b59133..72de1d3 100644 --- a/README.md +++ b/README.md @@ -238,13 +238,28 @@ Thanks a lot for spending your time helping! Keep rocking 🍻 YUNGH OG + + + SiddheshKukade +
+ Siddhesh Bhupendra Kuakde +
+ + + + varunKT001 +
+ Varun Tiwari +
+ avyayjain
Avyay Jain
- + + drk1rd @@ -258,8 +273,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Null
- - + rohitgarud21 @@ -287,7 +301,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Srinjoy Pati
- + + Shradha-Suman @@ -301,8 +316,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Nishant Pacharne
- - + thegeekyb0y @@ -330,7 +344,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Mayuri Kolhe
- + + parinzee @@ -344,21 +359,6 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
Sayan Roy
- - - - - SiddheshKukade -
- Siddhesh Bhupendra Kuakde -
- - - - varunKT001 -
- Varun Tiwari -
diff --git a/scripts/JSON-to-YAML Converter/README.md b/scripts/JSON-to-YAML Converter/README.md new file mode 100644 index 0000000..fc103bc --- /dev/null +++ b/scripts/JSON-to-YAML Converter/README.md @@ -0,0 +1,4 @@ + ### JSON to YAML file converter + Takes JSON data and converts it into YAML file by braking the JSON array and using the YAML library of python + ### To Execute the code + `json2yaml.py input_file.json output_file.yaml` diff --git a/scripts/JSON-to-YAML Converter/json2yaml.py b/scripts/JSON-to-YAML Converter/json2yaml.py new file mode 100644 index 0000000..9323e69 --- /dev/null +++ b/scripts/JSON-to-YAML Converter/json2yaml.py @@ -0,0 +1,35 @@ +import json +import os +import sys +import yaml + +# Checking there is a file name passed +if len(sys.argv) > 1: + # Opening the file + if os.path.exists(sys.argv[1]): + source_file = open(sys.argv[1], "r") + source_content = json.load(source_file) + source_file.close() + # Failikng if the file isn't found + else: + print("ERROR: " + sys.argv[1] + " not found") + exit(1) +# No file, no usage +else: + print("Usage: json2yaml.py [target_file.yaml]") + +# Processing the conversion +output = yaml.dump(source_content) + +# If no target file send to stdout +if len(sys.argv) < 3: + print(output) +# If the target file already exists exit +elif os.path.exists(sys.argv[2]): + print("ERROR: " + sys.argv[2] + " already exists") + exit(1) +# Otherwise write to the specified file +else: + target_file = open(sys.argv[2], "w") + target_file.write(output) + target_file.close()