Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 JSON file Loading issue
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 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)
error I am getting:

File "C:\ProgramData\Anaconda3\lib\json\", line 355, in raw_decode obj, end = self.scan_once(s, idx) JSONDecodeError: Invalid \escape
buran wrote Aug-27-2018, 02:08 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have fixed tags for you.
See BBcode help for more info.
make sure your json file is valid. e.g.
Is there a file path in your json file?

Sometimes with Windows it's much less troublesome to just use fwd slashes in your absolute paths... like in Linux.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  memory issue loading movie to numpy array djf123 1 174 Nov-07-2019, 06:19 AM
Last Post: ThomasL
  save my sensor data from the bme680 into a json or csv file Plastefuchs84 1 433 Aug-23-2019, 03:04 AM
Last Post: Plastefuchs84
  loading a csv file into python from pandas. Variable is not recognized vijjumodi 2 599 Apr-19-2019, 04:09 AM
Last Post: kus
  Merge JSON files prioritizing the updated values from most recent file nebulae 0 624 Apr-17-2019, 10:15 AM
Last Post: nebulae
  reading, modifying and writing json file metalray 2 6,658 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 1,295 May-20-2018, 11:25 AM
Last Post: scidam
  loading a 3D array from a bin file Mark3232 1 1,001 May-04-2018, 11:36 AM
Last Post: j.crater
  Reading json file as pandas data frame? Alberto 1 5,530 Feb-05-2018, 12:43 AM
Last Post: snippsat

Forum Jump:

Users browsing this thread: 1 Guest(s)