Re: [U2] JSON

2011-07-15 Thread Kevin King
And those kinds of relationships (as Rex pointed out) can be a beautiful
thing.
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON

2011-07-15 Thread Rex Gozar
George,

Individual MV's are pretty simple, but associated MV's can get interesting:

{
"idCode": "178",
"cusName": "U2Logic",
"contacts": [
{
"name": "David Aitken",
"cellPhone": "303-555-1234"
},
{
"name": "Doug Averch",
"cellPhone": "303-555-6728"
},
{
"name": "Carmen Electra",
"cellPhone": "303-555-7726"
}
]
}

rex
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON

2011-07-15 Thread Doug Averch
The reason for nesting them is that there maybe subvalues or text marks or
item marks.  That way the syntax of using them does not have to change in
JavaScript except to add another array position.

Regards,
Doug
www.u2logic.com
"Makers of the 3 click resizer"
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON

2011-07-14 Thread Rob Sobers
I can't see a reason for the nested arrays either.  This validates just
fine:

[
{
"IdCode": "178",
"CusName": "U2Logic",
"ContactName": [
"David Aitken",
"Doug Averch",
"Ed Karlo"
]
}
]

On Thu, Jul 14, 2011 at 9:28 PM, Kevin King  wrote:

> Ah drat, I knew I should have validated before posting.  That's what
> confidence'll get ya.. :)
>
> The first one was valid.  The second is missing a } at the end, and the
> third one should have ended in }}} instead of ]}.
>
> Regarding this:
>
> > [{"IdCode":"178","CusName":"U2Logic","ContactName":[["David
> Aitken"],["Doug
> > Averch"],["Ed Karlo"]]}]
> >
>
> I'm wondering why the names are in nested arrays instead of a single array
> with three names?
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON

2011-07-14 Thread Kevin King
Ah drat, I knew I should have validated before posting.  That's what
confidence'll get ya.. :)

The first one was valid.  The second is missing a } at the end, and the
third one should have ended in }}} instead of ]}.

Regarding this:

> [{"IdCode":"178","CusName":"U2Logic","ContactName":[["David Aitken"],["Doug
> Averch"],["Ed Karlo"]]}]
>

I'm wondering why the names are in nested arrays instead of a single array
with three names?
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON

2011-07-14 Thread Doug Averch
Hi Kevin:

I could not get you code to validate, see: http://jsonlint.com/, nor could I
get my suggestion to validate either.

Here is some real code read for Universe and this does validate.  The
Contact Name is multivalued attribute.

[{"IdCode":"178","CusName":"U2Logic","ContactName":[["David Aitken"],["Doug
Averch"],["Ed Karlo"]]}]


Regards,
Doug
www.u2logic.com
"U2WebLink middleware using Apache Tomcat"
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON

2011-07-14 Thread Kevin King
At the risk of correcting Doug, if this is your input:


this
is
a
mv
test


...in JSON there could be represented a few different ways.  It could be as
simple as:

["this","is","a",["mv","test"]]

Or as complex as:

{"TEST":{"part1":"this","part2":"is","part3":"a","part4":["mv","test"]}

..or even..

{"TEST":{"part1":"this","part2":"is","part3":"a","part4":{"vm1":"mv","vm2":"test"]}

...or other variations as agreed upon by sender and receiver.  For MV, a
simple nested array or a simple name/value object can work beautifully.

The point is that there are several options for how the values are presented
and that flexibility can be a wonderful thing.
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON

2011-07-14 Thread Doug Averch
George:

We have been using JSON for many years now with our Web integration on
Universe and Unidata.  This is how your JSON string could look:

{"TEST" : {
   "part1" : "this",
   "part2" : "is",
   "part3" : "a",
   "part4" : ["mv"],["test"]
}}

Regards,
Doug
www.u2logic.com
"U2WebLink middleware for U2"


On Thu, Jul 14, 2011 at 3:29 PM, George Gallen wrote:

> If I have the following dynamic array: TEST
> <1>this
> <2>is
> <3>a
> <4>mv ] test
>
> field 1 = part1
> field2 = part2
> field3 = part3
> field4 = part4
>
> I could make XML as
>
> 
>   this
>   is
>   a
>   mv
>   test
> 
>
> I'm confused on how this serializes to JSON? Of course I've only been
> working with it for a few hours...
>
> {"TEST" : {
>"part1" : "this",
>"part2" : "is",
>"part3" : "a",
> ==this is where I can't figure out how to setup "part4"?
> }}
>
>
>
> George Gallen
> Senior Programmer/Analyst
> Accounting/Data Division, EDI Administrator
> ggal...@wyanokegroup.com
> ph:856.848.9005 Ext 220
> The Wyanoke Group
> http://www.wyanokegroup.com
>
>
>
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON

2011-07-14 Thread Steve Romanow
Doh.  Autocorrect got me.  I meant json record.

Take a look at json.org

That XML example is but one may to model that record.
On Jul 14, 2011 5:36 PM, "Steve Romanow"  wrote:
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON

2011-07-14 Thread Steve Romanow
Att 4 can be encoded on its own and stored within the parent Jon record.  I
am on my phone so pls don't make me key data structures.  B-)
On Jul 14, 2011 5:32 PM, "George Gallen"  wrote:
> If I have the following dynamic array: TEST
> <1>this
> <2>is
> <3>a
> <4>mv ] test
>
> field 1 = part1
> field2 = part2
> field3 = part3
> field4 = part4
>
> I could make XML as
>
> 
> this
> is
> a
> mv
> test
> 
>
> I'm confused on how this serializes to JSON? Of course I've only been
working with it for a few hours...
>
> {"TEST" : {
> "part1" : "this",
> "part2" : "is",
> "part3" : "a",
> ==this is where I can't figure out how to setup "part4"?
> }}
>
>
>
> George Gallen
> Senior Programmer/Analyst
> Accounting/Data Division, EDI Administrator
> ggal...@wyanokegroup.com
> ph:856.848.9005 Ext 220
> The Wyanoke Group
> http://www.wyanokegroup.com
>
>
>
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


[U2] JSON

2011-07-14 Thread George Gallen
If I have the following dynamic array: TEST
<1>this
<2>is
<3>a
<4>mv ] test

field 1 = part1
field2 = part2
field3 = part3
field4 = part4

I could make XML as


   this
   is
   a
   mv
   test


I'm confused on how this serializes to JSON? Of course I've only been working 
with it for a few hours...

{"TEST" : {
"part1" : "this",
"part2" : "is",
"part3" : "a",
==this is where I can't figure out how to setup "part4"?
}}



George Gallen
Senior Programmer/Analyst
Accounting/Data Division, EDI Administrator
ggal...@wyanokegroup.com
ph:856.848.9005 Ext 220
The Wyanoke Group
http://www.wyanokegroup.com



___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON Parsing

2010-12-14 Thread Tony Gravagno
> From: Rob Sobers
> How do you handle JSON strings that have 
> more depth than sub-values can accommodate?


PMJI - On one hand I'll say I believe it's not appropriate to
approach storage of N-level structures in a 4-level MV structure
(item,atb,val,sv).  This is the first thing people did when they
wanted to do XML to MV and most projects like this end up
unfinished or limited because they're simply not prepared to deal
with the real world.  I think it makes more sense to create a
general purpose parser which scans JSON or XML for specific data
according to a schema, storing that data in a MV schema that's
unique for each application.  In other words, approach JSON for
an Order as an Order and not as a data structure that needs to be
converted to some intermediary format.  This kind of development
leads to something more like a XPath/XQuery processor than a
simple data conversion tool.  More specifically, you're
pro-actively querying the JSON/XML document for specific
structures, rather than just processing whatever comes along.
This concept is a focal point in a lot of parser discussions, not
just MV.

On the other hand, here is a proposal.  Over a decade ago I did
come up with a way to store any number of tiers of data in MV
structures.  This became the the prototype storage mechanism in
the TigerLogic XDMS (XML Data Management System).  Atb1 contains
multiple values with only top-level node names.  Atb2 either has
data, or Atb3 will have a pointer to an attribute further down
the item where tier-2 data for that node is stored.  The XML
version of this used other atbs for node/element attributes,
namespaces, and other metadata.  So atb1 points to something like
atb16.  Atb16-18 are structured just like 1-3, except with tier-2
data.  As you can probably see, this structure can accommodate
any number of nodes at a given tier (they're just MVs), and any
number of sub-tiers for each node.  That said, this is only good
for structures up to a few hundred K.  If you have a Lot of nodes
in any tier, this primary item can point to other items rather
than just attributes within the same item (another fourth
attribute might be allocated for this so that in any  structure
the first atb has MV names, second has corresponding MV values OR
third has a pointer to an atb with another tier OR fourth has an
item ID to another item.  So for multi-item structure with an
Order, you might point to a Header item and a Detail item
manager, Headers might point to a complex BillTo item and a
ShipTo item as well as contain local data like order ID, order
date, total value, etc.  The Detail "manager" item points to any
number of detail items, just as you might in your application.
The difference here is that the items are not structured
according to your hard-coded attribute references in BASIC or
dict items, they're dynamically created during a parse, and it's
up to some application code to then follow the tree structures
through the items to retrieve desired data.

OK, there ya have it, have fun!

Tony Gravagno
Nebula Research and Development
TG@ remove.pleaseNebula-RnD.com
Nebula R&D sells mv.NET worldwide
and provides related development services
remove.pleaseNebula-RnD.com/blog
Visit PickWiki.com! Contribute!
http://Twitter.com/TonyGravagno

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON Parsing

2010-12-14 Thread Symeon Breen
I have many web applications that have much much more complex data than just
to sub value level - luckily both json and the plethora of data types in
.net make this easy.

 

From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Doug
Sent: 14 December 2010 20:39
To: 'U2 Users List'
Subject: Re: [U2] JSON Parsing

 

Hi Rob:

I do not use anything more than Sub-values on the Web.  It just get to
complicated.  However, I have an idea that might work for those that love
the @IM and @TM.

Here is an example from the Wikipedia page modified:
{
 "firstName": "John",
 "lastName": "Smith",
 "age": 25,
 "address":
 {
 "streetAddress": "21 2nd Street",
 "city": "New York",
 "state": "NY",
 "postalCode": "10021"
 },
 "phoneNumber":[  {  "@VM": "3035551212", "@SM":
"3035551234","@TM":"3035551214"  },  { "@VM": "2125551212", "@IM":
"212567" } ]
 }

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Rob Sobers
Sent: Tuesday, December 14, 2010 11:45 AM
To: U2 Users List
Subject: Re: [U2] JSON Parsing

Hi Doug,

So you do the conversion from JSON to U2 Dynamic Array *before* you hit the
database layer (i.e., not in UniBasic)?  How do you handle JSON strings that
have more depth than sub-values can accommodate?

-Rob

On Tue, Dec 14, 2010 at 10:34 AM, Doug  wrote:

> We call the product XLr8 and it runs on Apache Tomcat.  XLr8 can run
> your favorite language PHP.  Or XLr8 can run JSP, HTML, or JavaScript. 
> Our technology is licensed and not open sourced, so you will have to
> purchase a license.
>
> -Original Message-
> From: u2-users-boun...@listserver.u2ug.org
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Kevin King
> Sent: Monday, December 13, 2010 4:10 PM
> To: U2 Users List
> Subject: Re: [U2] JSON Parsing
>
> Yes, on the BASIC side.  You use CHANGE in BASIC to convert a
> multidimensional JSON object to a dynamic array?  Okay, you have my
> attention... do tell please.
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users 

  _  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1170 / Virus Database: 426/3315 - Release Date: 12/14/10

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON Parsing

2010-12-14 Thread Doug
I forgot to say the @ symbol was for demonstration purposes only...

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Doug
Sent: Tuesday, December 14, 2010 1:39 PM
To: 'U2 Users List'
Subject: Re: [U2] JSON Parsing

Hi Rob:

I do not use anything more than Sub-values on the Web.  It just get to
complicated.  However, I have an idea that might work for those that love
the @IM and @TM.

Here is an example from the Wikipedia page modified:
{
 "firstName": "John",
 "lastName": "Smith",
 "age": 25,
 "address": 
 {
 "streetAddress": "21 2nd Street",
 "city": "New York",
 "state": "NY",
 "postalCode": "10021"
 },
 "phoneNumber":[  {  "@VM": "3035551212", "@SM":
"3035551234","@TM":"3035551214"  },  { "@VM": "2125551212", "@IM":
"212567" } ]
 }

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Rob Sobers
Sent: Tuesday, December 14, 2010 11:45 AM
To: U2 Users List
Subject: Re: [U2] JSON Parsing

Hi Doug,

So you do the conversion from JSON to U2 Dynamic Array *before* you hit the
database layer (i.e., not in UniBasic)?  How do you handle JSON strings that
have more depth than sub-values can accommodate?

-Rob

On Tue, Dec 14, 2010 at 10:34 AM, Doug  wrote:

> We call the product XLr8 and it runs on Apache Tomcat.  XLr8 can run 
> your favorite language PHP.  Or XLr8 can run JSP, HTML, or JavaScript.
> Our technology is licensed and not open sourced, so you will have to 
> purchase a license.
>
> -Original Message-
> From: u2-users-boun...@listserver.u2ug.org
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Kevin King
> Sent: Monday, December 13, 2010 4:10 PM
> To: U2 Users List
> Subject: Re: [U2] JSON Parsing
>
> Yes, on the BASIC side.  You use CHANGE in BASIC to convert a 
> multidimensional JSON object to a dynamic array?  Okay, you have my 
> attention... do tell please.
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON Parsing

2010-12-14 Thread Doug
Hi Rob:

I do not use anything more than Sub-values on the Web.  It just get to
complicated.  However, I have an idea that might work for those that love
the @IM and @TM.

Here is an example from the Wikipedia page modified:
{
 "firstName": "John",
 "lastName": "Smith",
 "age": 25,
 "address": 
 {
 "streetAddress": "21 2nd Street",
 "city": "New York",
 "state": "NY",
 "postalCode": "10021"
 },
 "phoneNumber":[  {  "@VM": "3035551212", "@SM":
"3035551234","@TM":"3035551214"  },  { "@VM": "2125551212", "@IM":
"212567" } ]
 }

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Rob Sobers
Sent: Tuesday, December 14, 2010 11:45 AM
To: U2 Users List
Subject: Re: [U2] JSON Parsing

Hi Doug,

So you do the conversion from JSON to U2 Dynamic Array *before* you hit the
database layer (i.e., not in UniBasic)?  How do you handle JSON strings that
have more depth than sub-values can accommodate?

-Rob

On Tue, Dec 14, 2010 at 10:34 AM, Doug  wrote:

> We call the product XLr8 and it runs on Apache Tomcat.  XLr8 can run 
> your favorite language PHP.  Or XLr8 can run JSP, HTML, or JavaScript.  
> Our technology is licensed and not open sourced, so you will have to 
> purchase a license.
>
> -Original Message-
> From: u2-users-boun...@listserver.u2ug.org
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Kevin King
> Sent: Monday, December 13, 2010 4:10 PM
> To: U2 Users List
> Subject: Re: [U2] JSON Parsing
>
> Yes, on the BASIC side.  You use CHANGE in BASIC to convert a 
> multidimensional JSON object to a dynamic array?  Okay, you have my 
> attention... do tell please.
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON Parsing

2010-12-14 Thread Rob Sobers
Hi Doug,

So you do the conversion from JSON to U2 Dynamic Array *before* you hit the
database layer (i.e., not in UniBasic)?  How do you handle JSON strings that
have more depth than sub-values can accommodate?

-Rob

On Tue, Dec 14, 2010 at 10:34 AM, Doug  wrote:

> We call the product XLr8 and it runs on Apache Tomcat.  XLr8 can run your
> favorite language PHP.  Or XLr8 can run JSP, HTML, or JavaScript.  Our
> technology is licensed and not open sourced, so you will have to purchase a
> license.
>
> -Original Message-
> From: u2-users-boun...@listserver.u2ug.org
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Kevin King
> Sent: Monday, December 13, 2010 4:10 PM
> To: U2 Users List
> Subject: Re: [U2] JSON Parsing
>
> Yes, on the BASIC side.  You use CHANGE in BASIC to convert a
> multidimensional JSON object to a dynamic array?  Okay, you have my
> attention... do tell please.
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON Parsing

2010-12-14 Thread Doug
We call the product XLr8 and it runs on Apache Tomcat.  XLr8 can run your
favorite language PHP.  Or XLr8 can run JSP, HTML, or JavaScript.  Our
technology is licensed and not open sourced, so you will have to purchase a
license.

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Kevin King
Sent: Monday, December 13, 2010 4:10 PM
To: U2 Users List
Subject: Re: [U2] JSON Parsing

Yes, on the BASIC side.  You use CHANGE in BASIC to convert a
multidimensional JSON object to a dynamic array?  Okay, you have my
attention... do tell please.
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] JSON Parsing

2010-12-13 Thread Kevin King
Yes, on the BASIC side.  You use CHANGE in BASIC to convert a
multidimensional JSON object to a dynamic array?  Okay, you have my
attention... do tell please.
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


[U2] JSON Parsing

2010-12-13 Thread Doug
I assume Kevin you are talking about on the UniBasic  side because on
JavaScript or Java this is simple array processing.  My routine I built over
6 years ago handles hundreds of thousands of transactions a hour with no
problem.  I just use the CHANGE function to convert it to a dynamic array.
Life really is simple because of these basic routines.   Pun intended...

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Kevin King
Sent: Saturday, December 11, 2010 4:29 PM
To: U2 Users List
Subject: Re: [U2] Sparse array population in Pick

We also do a lot with JSON but a JSON string can go far beyond attributes,
values, and subvalues.  Would be interested in Doug's take on how to extract
something out of a JSON string without parsing it from scratch on every
extraction, and how he would represent 4 or more dimensions in a MV item?

Building JSON is simple in MV Basic.   Parsing it can be a bit more
difficult.
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users