---
title: "读取配置.json配置文件"
author: "fanfq"
date: "2020-04-21T16:31:46Z"
tags: []
categories: ["移动开发"]
slug: "json"
draft: false
lastmod: "2020-04-21T16:32:50Z"
id: 2513764
url: "https://fanfq.iteye.com/blog/2513764"
---

```java

//获取assets/resources/routeline/r001.json文件，注意文件目录一定要在 assets/resources/下
cc.loader.loadRes('routeline/r001', function (err, object) {
    if (err) {
        console.log(err);
        return;
    }
    // this.allLevelConfig = object.json.level;
    // this.allLevelCount = object.json.levelCount;
}.bind(this));


```