import json
import hashlib


def json_hash(obj):
    dump = json.dumps(obj, sort_keys=True)
    h = hashlib.sha256()
    h.update(dump)
    return h.hexdigest()

import json
import hashlib


def json_hash(obj):
    dump = json.dumps(obj, sort_keys=True, separators=(',', ':'))
    h = hashlib.sha256()
    h.update(dump)
    return h.hexdigest()

Remove whitespace from json hash
Remove whitespace from json hash

Reasoning:

https://github.com/aanand/fig/commit/e5d8447f063498164f12567554a2eec16b4a3c88#commitcomment-11243708

Signed-off-by: Ben Firshman <73675debcd8a436be48ec22211dcf44fe0df0a64@firshman.co.uk>

  import json
  import hashlib
  
  
  def json_hash(obj):
-     dump = json.dumps(obj, sort_keys=True)
+     dump = json.dumps(obj, sort_keys=True, separators=(',', ':'))
      h = hashlib.sha256()
      h.update(dump)
      return h.hexdigest()
  
Remove whitespace from json hash
## Code Before:
import json
import hashlib


def json_hash(obj):
    dump = json.dumps(obj, sort_keys=True)
    h = hashlib.sha256()
    h.update(dump)
    return h.hexdigest()

## Instruction:
Remove whitespace from json hash
## Code After:
import json
import hashlib


def json_hash(obj):
    dump = json.dumps(obj, sort_keys=True, separators=(',', ':'))
    h = hashlib.sha256()
    h.update(dump)
    return h.hexdigest()
