Git Product home page Git Product logo

Comments (6)

alexantenna avatar alexantenna commented on May 4, 2024 6

Ah, I see. I need not to call person.toJson() directly but pass person to JSON.encode().

from json_serializable.dart.

madisona avatar madisona commented on May 4, 2024 3

FWIW - I did the same thing and spent some time spinning on this. Might be good to show a little more usage in the readme to prevent others from the same issue.

from json_serializable.dart.

SaadArdati avatar SaadArdati commented on May 4, 2024 2

Ah, I see. I need not to call person.toJson() directly but pass person to JSON.encode().

.... This is so stupid.

from json_serializable.dart.

kevmoo avatar kevmoo commented on May 4, 2024 2

JSON.encode().

Stuck for a time on this last year, and this year again :D

Just use https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonSerializable/explicitToJson.html

from json_serializable.dart.

cbatson avatar cbatson commented on May 4, 2024 1

Five years going and still a roadbump. Haven't found the trick yet though. @alexantenna where is JSON.encode() located? I see jsonEncode() and json.encode() but not JSON.encode(). Plus, I want a Map, not a String.

It seems the generated fromJson() handles nesting, but not the generated toJson(). I don't understand why the disparity.

from json_serializable.dart.

langhoangal avatar langhoangal commented on May 4, 2024

JSON.encode().

Stuck for a time on this last year, and this year again :D

from json_serializable.dart.

Related Issues (20)

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.