Python Forum
JSON file Loading issue
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
JSON file Loading issue
#1
Hi all,

I am getting below error, tried multiple ways, which are available online.
but still i am getting the error. could you please let me what is reason for error.
and how can i fix it.

Code i am running:
import nltk
from nltk.stem.lancaster import LancasterStemmer
import numpy as np
import tflearn
import tensorflow as tf
import random
import json
import string
import unicodedata
import sys

# a table structure to hold the different punctuation used
tbl = dict.fromkeys(i for i in range(sys.maxunicode)
                    if unicodedata.category(chr(i)).startswith('P'))


# method to remove punctuations from sentences.
def remove_punctuation(text):
    return text.translate(tbl)

# initialize the stemmer
stemmer = LancasterStemmer()
# variable to hold the Json data read from the file
data = None

# read the json file and load the training data
with open('D:\\News wype\\Sample_Data.json', 'r', encoding='utf8', errors='ignore') as json_data:
    data = json.load(json_data)
    print(data)
error I am getting:

Error:
File "C:\ProgramData\Anaconda3\lib\json\decoder.py", line 355, in raw_decode obj, end = self.scan_once(s, idx) JSONDecodeError: Invalid \escape
Reply


Messages In This Thread
JSON file Loading issue - by punna111 - Aug-27-2018, 01:55 PM
RE: JSON file Loading issue - by buran - Aug-27-2018, 02:10 PM
RE: JSON file Loading issue - by rootVIII - Aug-27-2018, 08:35 PM
RE: JSON file Loading issue - by 0LI5A3A - Jun-28-2020, 10:58 PM
RE: JSON file Loading issue - by buran - Jun-29-2020, 08:07 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  HELP! Importing json file into csv into jupyter notebook vilsef 2 2,594 Jan-22-2021, 11:06 AM
Last Post: snippsat
  Loading multiple JSON files to create a csv 0LI5A3A 0 2,118 Jun-28-2020, 10:35 PM
Last Post: 0LI5A3A
  Indirectlty convert string to float in JSON file WBPYTHON 6 5,968 May-06-2020, 12:09 PM
Last Post: WBPYTHON
  Help batch converting .json chosen file to MySQL BrandonKastning 2 2,362 Mar-14-2020, 09:19 PM
Last Post: BrandonKastning
  memory issue loading movie to numpy array djf123 1 2,318 Nov-07-2019, 06:19 AM
Last Post: ThomasL
  save my sensor data from the bme680 into a json or csv file Plastefuchs84 1 3,157 Aug-23-2019, 03:04 AM
Last Post: Plastefuchs84
  loading a csv file into python from pandas. Variable is not recognized vijjumodi 2 2,935 Apr-19-2019, 04:09 AM
Last Post: kus
  Merge JSON files prioritizing the updated values from most recent file nebulae 0 2,551 Apr-17-2019, 10:15 AM
Last Post: nebulae
  reading, modifying and writing json file metalray 2 10,957 Jun-06-2018, 03:09 PM
Last Post: metalray
  Issue in getting the required data from nested json and store it in a pandas datafram PrateekG 2 3,322 May-20-2018, 11:25 AM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020