python - Forward slash in json file from pandas dataframe -
i'm complete newbie json, appreciated. i'm trying convert dataframe json file.
import pandas pd df = pd.dataframe({ 'a' : [1., 2.5], 'b' : ['img/blue.png', 'img/red.png']}) print df
output is
b 0 1.0 img/blue.png 1 2.5 img/red.png
i make json file looks this:
'[1.0,"img/blue.png"],[2.5,"img/red.png"]'
however, when use following
out = df.to_json(orient='values')[1:-1] print out
i instead
'[1.0,"img\\/blue.png"],[2.5,"img\\/red.png"]'
how can forward slash print correctly in json file?
i'm not believe want those. think forward slash break json , needs escaped. have verified added slashes issue?
Comments
Post a Comment