Skip to content

Instantly share code, notes, and snippets.

// This is a simple example how you can get data from the GraphQL endpoint of
// your Shopify store.
// For the explanatory article please visit:
package main
import (
"bytes"
"io/ioutil"
"fmt"
@m3tam3re
m3tam3re / json_basics_2
Created July 12, 2019 09:41
JSON Basics in Python 2 - Output
dict_items([('Kopfknoten', {'Knoten1': 'mein Knoten 1', 'Knoten2': 'mein Knoten 2', 'Knoten3': 'mein Knoten 3'})])
@m3tam3re
m3tam3re / json_basics_2.py
Created July 12, 2019 09:39
JSON Basics in Python 1 - read JSON file
with open('jsonfile.json', 'r') as file:
json_dict = json.load(file)
my_dict = json.load(json_dict)
print(my_dict.items()
@m3tam3re
m3tam3re / json_basics_1.py
Created July 12, 2019 09:34
JSON Basics in Python 2 - Saving to file
with open('jsonfile.json', 'w') as file:
my_dict = {'Kopfknoten': {'Knoten1':'mein Knoten 1', 'Knoten2': 'mein Knoten 2', 'Knoten3': 'mein Knoten 3'}}
json_dict = json.dumps(my_dict, indent=4)
json.dump(json_dict, file)
@m3tam3re
m3tam3re / json_basics_1.json
Created July 12, 2019 09:32
JSON Basics in Python 1 - Output
{
"Kopfknoten": {
"Knoten1": "mein Knoten 1",
"Knoten2": "mein Knoten 2",
"Knoten3": "mein Knoten 3"
}
}
@m3tam3re
m3tam3re / json_basics_1.py
Last active July 12, 2019 09:30
JSON Basics in Python 1
import json ...
my_dict = {'Kopfknoten': {'Knoten1':'mein Knoten 1', 'Knoten2': 'mein Knoten 2', 'Knoten3': 'mein Knoten 3'}}
json_dict = json.dumps(my_dict, indent=4)
print(json_dict)