#!/usr/bin/env python3
#-*- coding: utf-8 -*-

import json


"""
   dictionary  to json string
   
   dictionary can be defined in python with 'curly braces'
   
    my_dictionary = {
        "name": "myname",
        "value": "avalue"
        }
        
    another way to creat a dict is
     
    my_dictionary = dict()
    my_dictionary[ "name" ] = "myname"
    my_dictionary[ "value" ] = "avalue"
    
"""

d = {
    "name": "myname",
    "value": "avalue"
    }

result = json.dumps(d)
print( type(result), result)

# json to dict:

reloaded = json.loads(result)
print( type(reloaded), reloaded)


