Getting invalid json in RoR
Question: I have an array sku = `["MAPNQ20673"]`. On converting this to json using
sku.to_json I'm getting `"[\"MAPNQ20673\"]"`. This is an invalid json. I need
to pass this array to a python script.

    
    
    system "python2 /home/nish/stuff/repos/Untitled/voylla_staging_changes/app/models/ReviseItem.py #{sku.to_json} #{qtys.to_json}"
    

Then, I am using `json.loads(sys.argv[1])` to decode. But since the json is
invalid, I am getting the following error on decoding the json in python
script:

    
    
    raise ValueError("No JSON object could be decoded")
    ValueError: No JSON object could be decoded
    

How can i convert the array to a valid json?

**EDIT:** It works fine for me when I call the python script from a standalone
ruby program. But when I rty to do the same from controller of an RoR app, it
fails


Answer: This works prefectly for me with **Python 2.7** :

    
    
    >>> from json import dumps, loads
    >>> sku = ["MAPNQ20673"]
    >>> s = dumps(sku)
    >>> x = loads(s)
    >>> x == sku
    True
    >>> x
    [u'MAPNQ20673']
    

