I’ve been given a python script which takes JSON and returns JSON with all the 
keys alphabetized which is helpful for comparing revisions in version control. 
However, I can’t figure out how to use LAUNCH EXTERNAL PROCESS and pass some 
JSON to it and get the result back. If anyone here knows how it can be done, 
I’d appreciate the help (I know nothing about python). MacOS if it matters.

Here is the script:

#!/usr/bin/python
import fileinput
import json
if __name__ == "__main__":
  jsonStr = ''
  for a_line in fileinput.input():
    jsonStr = jsonStr + ' ' + a_line.strip()    
  jsonObj = json.loads(jsonStr)  
  print json.dumps(jsonObj, sort_keys=True, indent=2) 

--
Cannon.Smith
Synergy Farm Solutions Inc.
Hill Spring, AB Canada
403-626-3236
<can...@synergyfarmsolutions.com>
<www.synergyfarmsolutions.com>


**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to