summaryrefslogtreecommitdiffstats
path: root/powerline/lint/markedjson/__init__.py
blob: dea5faf710afecd3ac30afbfa00720fe414e8987 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)

from powerline.lint.markedjson.loader import Loader


def load(stream, Loader=Loader):
	'''Parse JSON value and produce the corresponding Python object

	:return:
		(hadproblem, object) where first argument is true if there were errors 
		during loading JSON stream and second is the corresponding JSON object.
	'''
	loader = Loader(stream)
	try:
		r = loader.get_single_data()
		return r, loader.haserrors
	finally:
		loader.dispose()