Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 549 Bytes

File metadata and controls

40 lines (32 loc) · 549 Bytes

python-pyson

Like JSON, but for Python.
Supports any eval() in key and value pairs.
(So don't go around using it in production)

Example

import time
import random

import pyson

content = """
{
	"time" : time.time(),
	random.randint(0, 1) : "a random number",
	"another_level" : {
		"test" : 5
	},
	"main level" : True
}
"""

print(pyson.loads(content, globals(), locals()))

Produces:

{
	'time': 1604261222.4304745,
	1: 'a random number',
	'another_level': {
		'test': 5
	},
	'main level': True
}