You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Greg Brown <gk...@mac.com> on 2010/08/26 02:05:58 UTC

New article on implementing and using web queries

In case anyone is interested:

http://java.dzone.com/articles/implementing-rest-services


Re: New article on implementing and using web queries

Posted by Noel Grandin <no...@gmail.com>.
I tend to agree that Pivot's extended syntax is sufficiently useful to warrant keeping it.

I'd be quite happy just documenting that we use an extension of JSON, rather than the "pure" specification.

-- Noel

Greg Brown wrote:
> Hi Chris,
>
> Good to hear from you.
>
> I find the optional quotes to be very convenient. I also find Pivot's support for single quotes very convenient, and this is also not an official part of the JSON spec. Consider a style declaration without that support:
>
> <BoxPane styles="{&quot;horizontalAlignment&quot;:&quot;center&quot;, &quot;verticalAlignment&quot;:&quot;center&quot;, ...}"/>
>
> vs.
>
> <BoxPane styles="{horizontalAlignment:'center', verticalAlignment:'center', ...}"/>
>  
>> I don't think Pivot is doing the greater community any favours by
>> encouraging this offshoot of JSON.  Pivot either needs to fix it, or call it
>> something else, because as it stands (in its weak undelimited form) it's not
>> JavaScript Object Notation, it's Pivot Object Notation.
> JavaScript itself supports the same optional syntax - single quotes or no quotes (when the key only contains valid identifier characters). Would you say that JavaScript has done the software community a disservice? Would you call JavaScript's use of JSON "JavaScript Object Notation"? Oh, wait...  ;-)
>
> When JSON is produced and consumed exclusively by machine, requiring quotes may not seem like a big deal. So I can see your argument with respect to the REST article, since it is about web services. However, JSON is often authored by hand in Pivot, and as such needs to be more convenient.
>
> I personally think the JSON spec itself should make quotes optional, and possibly also support single quotes. Enforcing quotes when they are not strictly necessary is needlessly draconian.
>
> G
>


Re: New article on implementing and using web queries

Posted by Greg Brown <gk...@mac.com>.
Hi Chris,

Good to hear from you.

I find the optional quotes to be very convenient. I also find Pivot's support for single quotes very convenient, and this is also not an official part of the JSON spec. Consider a style declaration without that support:

<BoxPane styles="{&quot;horizontalAlignment&quot;:&quot;center&quot;, &quot;verticalAlignment&quot;:&quot;center&quot;, ...}"/>

vs.

<BoxPane styles="{horizontalAlignment:'center', verticalAlignment:'center', ...}"/>
 
> I don't think Pivot is doing the greater community any favours by
> encouraging this offshoot of JSON.  Pivot either needs to fix it, or call it
> something else, because as it stands (in its weak undelimited form) it's not
> JavaScript Object Notation, it's Pivot Object Notation.

JavaScript itself supports the same optional syntax - single quotes or no quotes (when the key only contains valid identifier characters). Would you say that JavaScript has done the software community a disservice? Would you call JavaScript's use of JSON "JavaScript Object Notation"? Oh, wait...  ;-)

When JSON is produced and consumed exclusively by machine, requiring quotes may not seem like a big deal. So I can see your argument with respect to the REST article, since it is about web services. However, JSON is often authored by hand in Pivot, and as such needs to be more convenient.

I personally think the JSON spec itself should make quotes optional, and possibly also support single quotes. Enforcing quotes when they are not strictly necessary is needlessly draconian.

G


Re: New article on implementing and using web queries

Posted by Christopher Brind <br...@brindy.org.uk>.
Hi Greg,

Firstly, grats on the article.

Secondly, I know I've been very quiet for a while, but I've been continuing
to watch the mailing lists and haven't felt a need to step in until just
now.

Pivot's use of JSON is really starting to annoy me.  Example:

{
   name : "value"
}

This is NOT valid JSON, but it is both generated and read by Pivot.   The
correct version of this would be:

{
   "name" : "value"
}

This is defined clearly in both the ECMA spec and on the JSON web page:

http://www.ecma-international.org/publications/files/ecma-st/ECMA-262.pdf
http://www.json.org

Which states that

 JSONMember :

     JSONString : JSONValue



A JSONString is:

JSONString ::

    " JSONStringCharacters(optional) "


I have heard the argument for allowing poorly written JSON to be read by
Pivot in the past, but think it is an invalid argument, as I have never seen
anything which produces bad-JSON, apart from Pivot itself.

I know there's a flag called "alwaysDelimitMapKeys", but again I think
it's unnecessary because map keys should always be delimited.

I don't think Pivot is doing the greater community any favours by
encouraging this offshoot of JSON.  Pivot either needs to fix it, or call it
something else, because as it stands (in its weak undelimited form) it's not
JavaScript Object Notation, it's Pivot Object Notation.


Cheers,
Chris


On 26 August 2010 01:05, Greg Brown <gk...@mac.com> wrote:

> In case anyone is interested:
>
> http://java.dzone.com/articles/implementing-rest-services
>
>

Re: New article on implementing and using web queries

Posted by Martin Jimenez-Salazar <ex...@gmail.com>.
really nice! thanks, appreciate the link



2010/8/25 Greg Brown <gk...@mac.com>

> In case anyone is interested:
>
> http://java.dzone.com/articles/implementing-rest-services
>
>

Re: New article on implementing and using web queries

Posted by Martin Jimenez-Salazar <ex...@gmail.com>.
really nice! thanks, appreciate the link



2010/8/25 Greg Brown <gk...@mac.com>

> In case anyone is interested:
>
> http://java.dzone.com/articles/implementing-rest-services
>
>