class StepException(Exception):
    def __init__(self, context, message=''):
        self.message = message
        try:
            id_ = context.xml.xpath('iati-identifier/text()')[0]
            self.message = '{}: {}'.format(id_, self.message)
        except:
            pass

    def __str__(self):
        return self.message

@@ -1,8 +1,22 @@
+import json%0A%0A%0A
 class St
@@ -71,23 +71,22 @@
 ontext, 
-message
+errors
 =''):%0A  
@@ -100,25 +100,44 @@
 elf.
-message = message
+errors = errors%0A        self.id = ''
 %0A   
@@ -158,19 +158,23 @@
         
+self.
 id
-_
  = conte
@@ -219,70 +219,8 @@
 %5B0%5D%0A
-            self.message = '%7B%7D: %7B%7D'.format(id_, self.message)%0A
     
@@ -291,17 +291,90 @@
 urn 
-self.message
+json.dumps(%7B%0A            'errors': self.errors,%0A            'id': self.id,%0A        %7D)
 %0A

output json dump