Python Forum

Full Version: Handling escape charters while converting data frame to JSON
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,
I am new to the python programming so please bear with me if question seems to basic.

i have created url column in my dataframe

df['url'] = r"https://apps.occ.gov/EASearch/?Search=&Category=&ItemsPerPage=10&Sort=&AutoCompleteSelection="

df.head(5)

otherinfo entity ... dob url
0 ... https://apps.occ.gov/EASearch/?Search=&Categor...
1 ... https://apps.occ.gov/EASearch/?Search=&Categor...
2 ... https://apps.occ.gov/EASearch/?Search=&Categor...
3 ... https://apps.occ.gov/EASearch/?Search=&Categor...
4 ... https://apps.occ.gov/EASearch/?Search=&Categor...

but when i am converting my dataframe to json

df.to_json (r'filepath', orient='records')

In the create json, i am getting :

"url":"https:\/\/apps.occ.gov\/EASearch\/?Search=&Category=&ItemsPerPage=10&Sort=&AutoCompleteSelection="

How do i fix this