Align json.dumps and LASFile.to_json()
@@ -850,7 +850,7 @@ class LASFile(object):
"""Return object contents as a JSON string."""
return self.to_json()
- def to_json(self):
+ def to_json_old(self):
obj = OrderedDict()
for name, section in self.sections.items():
try:
@@ -859,6 +859,9 @@ class LASFile(object):
obj[name] = json.dumps(section)
return json.dumps(obj)
+ def to_json(self):
+ return json.dumps(self, cls=JSONEncoder)
+
@json.setter
def json(self, value):
raise Exception("Cannot set objects from JSON")
