Code Monkey home page Code Monkey logo

jsonformat4flutter's Issues

exe二次生成bean卡死崩溃

你好,感谢开源贡献。
我在使用过程中发现:首次生成bean没有问题,当程序窗口没有关闭的情况下再次复制另一个json格式化之后,点击红色区域命名的时候程序会卡死直至崩溃,望查验。

mac 使用问题

未能打开文稿“Formatter_mac”。文本编码“Unicode (UTF-8)”不适用。

IDEA plugin

怎么不把这个搞成 IDEA plugin 呢,这样不就方便很多了嘛。

macos下生成不成功

按照操作步骤执行生成后,只有“import 'dart:convert' show json;”这一句

生成错误

发生错误在通过以下:
{
"x":{
"q":[],
"t":[],
"e":[{}]
}
}

tostring的问题,建议

看到tostring里面大佬做了很多处理,但是发现还有问题,比如string是“”的时候。。tostring的字符串没法正常转换json。

建议生成类似这样的

 Map<String, dynamic> toJson() => {
        'id': id,
      };
  @override
  String toString() {
    // TODO: implement toString
    return json.encode(toJson());
  }

谢谢

关于生成class的构造函数的疑问

发现生成的class中只有一个带参的构造函数,如果我不直接传jsonStr进去,而是想初始化一个空的class。给class一个默认构造函数,给转换构造函数加一个命名是不是更好?

Json

{ "name": "BeJson", "email": "http://www.bejson.com", "list": [ "Google", "baidu", "facebook" ] }

Class,嵌套class以此类推

  class UserModel {

  String email;
  String name;
  List<String> list;

  UserModel(){
    list = [];
  }

  UserModel.byJson(jsonStr) {
  var jsonRes = json.decode(jsonStr);

    email = jsonRes['email'];
    name = jsonRes['name'];
    list = [];

  for (var listItem in jsonRes['list']){
    
      list.add(listItem);
    }
  }

初学dart,语法还不太熟,请见谅

json本身的顶层级不是对象而是数组,解析报错

image

[{"a":"xx","b":"bbb"},{"a":"xx","b":"bbbb"},{"a":"xx","b":"bbbbb"}]

image

dui对于这种整个json就是一个数组的,设置的没问题,解析报错
type 'String' is not a subtype of type 'int' of 'index'

我看了下,生成的代码jsonRes['json_list'],这里明显有问题,json_list这个key是不存在的,所以报错了

image

个人感觉对于这种类型,直接当做数组item的json来处理,额外再提供一下数组解析的方法就好了

获取不到解析内容

image
获取data里面有数据,用这个FollowList followList = new FollowList(data);,解析不了是什么原因

你好发现一个问题 在解析数组的时候会出点小问题

result数据为{"result":[{"name":"测试分类1","id":"1"},{"name":"测试分类3","id":"3"},{"name":"测试分类","id":"5"}]}
for (var resultItem in jsonRes['result']){

  result.add(new ListBean.fromJson(resultItem));
}

无法转换 会 'String' is not a subtype of type 'int' of 'index'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.