Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Small corrections to the JSON article #503

Closed
@nicolasgarnier

Description

@nicolasgarnier

From [email protected] on November 01, 2012 23:42:41

I read ( http://www.dartlang.org/articles/json-web-service/ ). Here are some small corrections:

var url = " http://example.com/programming-languages/"; req.open("POST", url); // POST to send data

It says "POST to send data", but I don't see any data.

A slight issue remains. Dart Editor displays warnings with this code, because JsonObject doesn’t
have methods such as language or targets. You could suppress the warnings by using the dynamic
var type, but then you don’t get code completion and more useful warnings.

I think that this is no longer the case. I think the Dart Editor will now suppress the warnings if there is a noSuchMethod method.

interface LanguageWebsite extends JsonObject

This approach won't work for deeply nested JSON will it? By the way, we switched from interfaces to abstract classes.

Using these features together takes advantage of the type checking available in the Dart tools,
enabling you to be confident that your code is accessing JSON data in a structured, strongly typed manner.

While it's true that you're reducing the likelihood of errors, if your interface spells stuff differently than the server does, you'll still get into trouble. Unless both your client and server are both written in Dart and both using the same interface, the potential for spelling errors still exists.

Original issue: http://code.google.com/p/dart/issues/detail?id=6470

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions