import json
from collections import OrderedDict


def format_json(input, settings=None):
    indent = 4
    if settings:
        indent = settings.get('tab_size', indent)
    try:
        data = json.loads(input, object_pairs_hook=OrderedDict)
        return json.dumps(data, indent=indent, separators=(',', ': ')), None
    except ValueError:
        return None, 'Invalid JSON'

import json
from collections import OrderedDict


def format_json(input, settings=None):
    indent = 4
    if settings:
        indent = settings.get('tab_size', indent)
    try:
        data = json.loads(input, object_pairs_hook=OrderedDict)
        return True, json.dumps(data, indent=indent, separators=(',', ': ')), None
    except ValueError:
        return False, None, 'Invalid JSON'

Fix parsing of JSON formatting errors
Fix parsing of JSON formatting errors

  import json
  from collections import OrderedDict
  
  
  def format_json(input, settings=None):
      indent = 4
      if settings:
          indent = settings.get('tab_size', indent)
      try:
          data = json.loads(input, object_pairs_hook=OrderedDict)
-         return json.dumps(data, indent=indent, separators=(',', ': ')), None
+         return True, json.dumps(data, indent=indent, separators=(',', ': ')), None
      except ValueError:
-         return None, 'Invalid JSON'
+         return False, None, 'Invalid JSON'
  
Fix parsing of JSON formatting errors
## Code Before:
import json
from collections import OrderedDict


def format_json(input, settings=None):
    indent = 4
    if settings:
        indent = settings.get('tab_size', indent)
    try:
        data = json.loads(input, object_pairs_hook=OrderedDict)
        return json.dumps(data, indent=indent, separators=(',', ': ')), None
    except ValueError:
        return None, 'Invalid JSON'

## Instruction:
Fix parsing of JSON formatting errors
## Code After:
import json
from collections import OrderedDict


def format_json(input, settings=None):
    indent = 4
    if settings:
        indent = settings.get('tab_size', indent)
    try:
        data = json.loads(input, object_pairs_hook=OrderedDict)
        return True, json.dumps(data, indent=indent, separators=(',', ': ')), None
    except ValueError:
        return False, None, 'Invalid JSON'
