我把一把一把大的“JSON”str到像这样明确的终点:
import bodyParser from body-parser ;
const app = express();
const jsonParser = bodyParser.json({ limit: 4mb });
const databaseUri = <db connection string> ;
const databaseClient = new MongoClient(databaseUri);
app.use(cors());
app.post( /fillDatabase , jsonParser, async (request, response) => {
const subjects = request.body;
console.log(`Filling database with ${subjects.length} subjects`);
const database = databaseClient.db( wanikani_db );
const subjectsTable = database.collection( subjects );
const result = await subjectsTable.insertMany(subjects).then((response) => {
console.log( inserted + response.insertedCount + subjects );
}).catch(() => {
console.log( failed to insert subjects );
}).finally(() => {
console.log( finally after inserting subjects );
});
});
当我担任“JSON”号星座时,终点功能将达到完成(见<代码>,在插入“ 日志”后定稿),但请求未完成。 我拿着ack痕。
SyntaxError: Bad control character in string literal in JSON at position 289
at JSON.parse (<anonymous>)
at parse (/Users/maxc/Documents/repos/wanikani-flashcards/backend/node_modules/body-parser/lib/types/json.js:92:19)
at /Users/maxc/Documents/repos/wanikani-flashcards/backend/node_modules/body-parser/lib/read.js:128:18
at AsyncResource.runInAsyncScope (node:async_hooks:206:9)
at invokeCallback (/Users/maxc/Documents/repos/wanikani-flashcards/backend/node_modules/raw-body/index.js:238:16)
at done (/Users/maxc/Documents/repos/wanikani-flashcards/backend/node_modules/raw-body/index.js:227:7)
at IncomingMessage.onEnd (/Users/maxc/Documents/repos/wanikani-flashcards/backend/node_modules/raw-body/index.js:287:7)
at IncomingMessage.emit (node:events:514:28)
at endReadableNT (node:internal/streams/readable:1376:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
正在破碎的JSON物体已贴上,。 中断的性质是数据――和;性质。
这里是:
000001c0: 2020 2020 2020 2020 2020 2022 6368 6172 "char
000001d0: 6163 7465 7273 223a 2022 e4b8 8022 2c0a acters": "...",.
第289号立场的特性是日本的特性。 我如何描述这种性质和其他类似特征?