Use JSON.parse instead of resolveJsonModule.

And fix typo.
This commit is contained in:
DitFranXX
2020-11-25 01:04:23 +09:00
parent 43e0716b85
commit e98db72efa
4 changed files with 11 additions and 5 deletions

View File

@@ -1,8 +1,8 @@
import * as path from "path";
import { readXML } from './helper';
import { music } from "./mdb_ex.json"
import { readJSON, readXML } from './helper';
export async function processData() {
const { music } = await readJSON(path.resolve(__dirname, './mdb_ex.json'))
return {
music,
};

View File

@@ -1,8 +1,8 @@
import * as path from "path";
import { readXML } from './helper';
import { music } from "./mdb_mt.json"
import { readJSON, readXML } from './helper';
export async function processData() {
const { music } = await readJSON(path.resolve(__dirname, './mdb_ex.json'))
return {
music,
};

View File

@@ -2,4 +2,10 @@ export async function readXML(path: string) {
const xml = await IO.ReadFile(path, 'utf-8');
const json = U.parseXML(xml, false)
return json
}
export async function readJSON(path: string) {
const str = await IO.ReadFile(path, 'utf-8');
const json = JSON.parse(str)
return json
}