Re: [WebDNA] JSON objects and [JSONstore]: new cell

This WebDNA talk-list message is from

2014


It keeps the original formatting.
numero = 111613
interpreted = N
texte = The new [JSONstore] is available on the v.8 fastCGI version for linux = and OSX. http://www.webdna.us/page.dna?numero=3D307 - chris On Sep 25, 2014, at 22:00, Jym Duane wrote: > looks like an excellent addition. >=20 > jym >=20 >=20 > On 9/25/2014 5:07 AM, christophe.billiottet@webdna.us wrote: >> Because more and more websites are relying on javascript (browser = side), we have decided to give WebDNA a tool to store complex JSON = objects into a flat database. >>=20 >> JSON object and XML format have more or less the same structure, = however XML specification does not match the data model for most = programming languages which makes it slow and tedious for programmers to = parse. Compared to JSON, XML has a low data-to-markup ratio which = results in it being more difficult for humans to read and write. JSON = standard is language-independent and its data structures, arrays and = objects, are universally recognized. These structures are supported in = some way by nearly all modern programming languages and are familiar to = nearly all programmers. These qualities make it an ideal format for data = interchange on the web. It handles different types of data: numbers, = strings, boolean, arrays=85 The problem relies in JSON objects structure = that can be complicated to handle as it can include other nested = objects, arrays, arrays with objects, objects with nested arrays, = objects with nested objects, object with nested arrays and objects=85 a = number of structures that are difficult to recognize and parse and even = more complicated to store. >>=20 >> The no-sql is one answer. I already explained here how to use WebDNA = as no-sql database, each JSON object being stored as a text file indexed = into a WebDNA database. >>=20 >> We went one step further and built a new tag, a =93cell=94 = [JSONstore] that can analyze, recognize, parse and store JSON object = into our usual WebDNA flat database. We made it solid and = stucture-independant. >>=20 >> So, let=92s see an example of a JSON Object with a nested array; this = should not be too difficult for a human to read >>=20 >> var myObject =3D { >> "first": "John", >> "last": "Doe", >> "age": 39, >> "interests": [ "Reading", "Mountain Biking", "Hacking" ], >> "favorites": { >> "color": "Blue", >> "sport": "Soccer", >> "food": "Spaghetti" >> }, >> "skills": [ >> { >> "category": "JavaScript", >> "tests": [ >> { "name": "One", "score": 90 }, >> { "name": "Two", "score": 96 } >> ] >> }, >> { >> "category": "CouchDB", >> "tests": [ >> { "name": "One", "score": 79 }, >> { "name": "Two", "score": 84 } >> ] >> }, >> { >> =93category": "WebDNA", >> "tests": [ >> { "name": "One", "score": 97 }, >> { "name": "Two", "score": 93 } >> ] >> } >> ] >> } >>=20 >>=20 >>=20 >>=20 >> We will make WebDNA store it in a flat database: simple data go the = usual way, like >>=20 >> first=3DJohn >> last=3DDoe >> age=3D39 >>=20 >> arrays will have a field with =93:array=94 appended to the field name = so WebDNA knows it is an array and that the content should not be = parsed. >>=20 >> interests:array=3D=93Reading=94,=93Mountain Biking=94,=93Hacking=94 >>=20 >> skills:array=3D{=93category=94:=94JavaScript=94,=94tests=94:[{=93name=94= :=94One", "score":90},{"name": "Two", "score": 96 = }]},{"category":"CouchDB","tests":[{"name":"One","score":79},{"name":"Two"= ,"score":84 }]}, = {=93category":"WebDNA",=93tests=94:[{"name":"One","score":97},{"name":"Two= ","score":93} >>=20 >> nested objects will be parsed and stored by appending the second = level field name to the first one, separated by a colon >>=20 >> favorites:color=3Dblue >> favorite:sport=3DSoccer >> favorite:food=3DSpaghetti >>=20 >>=20 >>=20 >> So, how to do that? first by preparing your database: it will include = these fields >>=20 >> firstlastageinterests:arrayfavorites:color= favorite:sport favorite:food skills:array >>=20 >> Then, using the new cell [JSONstore] and the database name >>=20 >> [JSONstore db=3Dwhatever.db] >> >> [/JSONstore] >>=20 >> (a debug=3Don option is available to know exactly what and how it is = stored) >>=20 >> by replacing by the actual object, the cell [JSONstore] = will populate the database like this, automatically >>=20 >> first=3DJohn >> last=3DDoe >> age=3D39 >> interests:array=3D=93Reading=94, =93Mountain Biking", "Hacking" >> favorites:color=3DBlue >> favorites:sport=3DSoccer >> favorites:food=3DSpaghetti >> skills:array=3D{ "category": "JavaScript", "tests": [ { "name": = "One", "score": 90 }, { "name": "Two", "score": 96 } ] }, { "category": = "CouchDB", "tests": [ { "name": "One", "score": 79 }, { "name": "Two", = "score": 84 } ] }, { "category": "WebDNA", "tests": [ { "name": "One", = "score": 97 }, { "name": "Two", "score": 93 } ] } >>=20 >> Sorting the data to recompose the original object is straightforward >>=20 >> { >> =93first=94: =93[first]", >> =93last=94: "[last]", >> =93interests=94: [interest:array], >> "favorites": { >> =93color=94: =93[favorite:color]=94, >> =93food=94: =93[favorite:food]" >> =93sport=94: =93[favorite:sport]" >> } >> =93skills=94: [skills:array] >> } >>=20 >>=20 >> JQUERY, for instance, will work well with it. >>=20 >> This has been tested against the following examples, some of them = being somewhat difficult to work with. >>=20 >>=20 >>=20 >>=20 >> -------------- >> { "accounting" : [ >> { "firstName" : "John", >> "lastName" : "Doe", >> "age" : 23 }, >> { "firstName" : "Mary", >> "lastName" : "Smith", >> "age" : 32 } >> ], >> "sales" : [ >> { "firstName" : "Sally", >> "lastName" : "Green", >> "age" : 27 }, >> { "firstName" : "Jim", >> "lastName" : "Galley", >> "age" : 41 } >> ] >> } >> -------------- >> { >> "problems": [{ >> "Diabetes":[{ >> "medications":[{ >> "medicationsClasses":[{ >> "className":[{ >> "associatedDrug":[{ >> "name":"asprin", >> "dose":"", >> "strength":"500 mg" >> }], >> "associatedDrug#2":[{ >> "name":"somethingElse", >> "dose":"", >> "strength":"500 mg" >> }] >> }], >> "className2":[{ >> "associatedDrug":[{ >> "name":"asprin", >> "dose":"", >> "strength":"500 mg" >> }], >> "associatedDrug#2":[{ >> "name":"somethingElse", >> "dose":"", >> "strength":"500 mg" >> }] >> }] >> }] >> }], >> "labs":[{ >> "" >> }] >> }], >> "Asthma":[{}] >> }] >> } >> -------------- >> { >> "medications":[{ >> "aceInhibitors":[{ >> "name":"lisinopril", >> "strength":"10 mg Tab", >> "dose":"1 tab", >> "route":"PO", >> "sig":"daily", >> "pillCount":"#90", >> "refills":"Refill 3" >> }], >> "antianginal":[{ >> "name":"nitroglycerin", >> "strength":"0.4 mg Sublingual Tab", >> "dose":"1 tab", >> "route":"SL", >> "sig":"q15min PRN", >> "pillCount":"#30", >> "refills":"Refill 1" >> }], >> "anticoagulants":[{ >> "name":"warfarin sodium", >> "strength":"3 mg Tab", >> "dose":"1 tab", >> "route":"PO", >> "sig":"daily", >> "pillCount":"#90", >> "refills":"Refill 3" >> }], >> "betaBlocker":[{ >> "name":"metoprolol tartrate", >> "strength":"25 mg Tab", >> "dose":"1 tab", >> "route":"PO", >> "sig":"daily", >> "pillCount":"#90", >> "refills":"Refill 3" >> }], >> "diuretic":[{ >> "name":"furosemide", >> "strength":"40 mg Tab", >> "dose":"1 tab", >> "route":"PO", >> "sig":"daily", >> "pillCount":"#90", >> "refills":"Refill 3" >> }], >> "mineral":[{ >> "name":"potassium chloride ER", >> "strength":"10 mEq Tab", >> "dose":"1 tab", >> "route":"PO", >> "sig":"daily", >> "pillCount":"#90", >> "refills":"Refill 3" >> }] >> } >> ], >> "labs":[{ >> "name":"Arterial Blood Gas", >> "time":"Today", >> "location":"Main Hospital Lab" >> }, >> { >> "name":"BMP", >> "time":"Today", >> "location":"Primary Care Clinic" >> }, >> { >> "name":"BNP", >> "time":"3 Weeks", >> "location":"Primary Care Clinic" >> }, >> { >> "name":"BUN", >> "time":"1 Year", >> "location":"Primary Care Clinic" >> }, >> { >> "name":"Cardiac Enzymes", >> "time":"Today", >> "location":"Primary Care Clinic" >> }, >> { >> "name":"CBC", >> "time":"1 Year", >> "location":"Primary Care Clinic" >> }, >> { >> "name":"Creatinine", >> "time":"1 Year", >> "location":"Main Hospital Lab" >> }, >> { >> "name":"Electrolyte Panel", >> "time":"1 Year", >> "location":"Primary Care Clinic" >> }, >> { >> "name":"Glucose", >> "time":"1 Year", >> "location":"Main Hospital Lab" >> }, >> { >> "name":"PT/INR", >> "time":"3 Weeks", >> "location":"Primary Care Clinic" >> }, >> { >> "name":"PTT", >> "time":"3 Weeks", >> "location":"Coumadin Clinic" >> }, >> { >> "name":"TSH", >> "time":"1 Year", >> "location":"Primary Care Clinic" >> } >> ], >> "imaging":[{ >> "name":"Chest X-Ray", >> "time":"Today", >> "location":"Main Hospital Radiology" >> }, >> { >> "name":"Chest X-Ray", >> "time":"Today", >> "location":"Main Hospital Radiology" >> }, >> { >> "name":"Chest X-Ray", >> "time":"Today", >> "location":"Main Hospital Radiology" >> } >> ] >> } >>=20 >> -------------- >>=20 >> { >> "first": "John", >> "skills": [{ >> "Diabetes":[{ >> "medications":[{ >> "medicationsClasses":[{ >> "className":[{ >> "associatedDrug":[{ >> "name":"asprin", >> "dose":"", >> "strength":"500 mg" >> }], >> "associatedDrug#2":[{ >> "name":"somethingElse", >> "dose":"", >> "strength":"500 mg" >> }] >> }], >> "className2":[{ >> "associatedDrug":[{ >> "name":"asprin", >> "dose":"", >> "strength":"500 mg" >> }], >> "associatedDrug#2":[{ >> "name":"somethingElse", >> "dose":"", >> "strength":"500 mg" >> }] >> }] >> }] >> }], >> "labs":[{ >> "" >> }] >> }], >> "Asthma":[{}] >> }] >> } >>=20 >> -------------- >>=20 >> {"widget": { >> "debug": "on", >> "window": { >> "title": "Sample Konfabulator Widget", >> "name": "main_window", >> "width": 500, >> "height": 500 >> }, >> "image": { >> "src": "Images/Sun.png", >> "name": "sun1", >> "hOffset": 250, >> "vOffset": 250, >> "alignment": "center" >> }, >> "text": { >> "data": "Click Here", >> "size": 36, >> "style": "bold", >> "name": "text1", >> "hOffset": 250, >> "vOffset": 100, >> "alignment": "center", >> "onMouseUp": "sun1.opacity =3D (sun1.opacity / 100) * 90;" >> } >> }} >>=20 >> -------------- >>=20 >> { >> "ref":1, >> "glossary": { >> "title": "example glossary", >> "GlossDiv": { >> "title": "S", >> "GlossList": { >> "GlossEntry": { >> "ID": "SGML", >> "SortAs": "SGML", >> "GlossTerm": "Standard = Generalized Markup Language", >> "Acronym": "SGML", >> "Abbrev": "ISO 8879:1986", >> "GlossDef": { >> "para": "A meta-markup language, used to = create markup languages such as DocBook.", >> "GlossSeeAlso": ["GML", = "XML"] >> }, >> "GlossSee": "markup" >> } >> } >> } >> } >> } >>=20 >> -------------- >>=20 >> {"web-app": { >> "servlet": [ >> { >> "servlet-name": "cofaxCDS", >> "servlet-class": "org.cofax.cds.CDSServlet", >> "init-param": { >> "configGlossary:installationAt": "Philadelphia, PA", >> "configGlossary:adminEmail": "ksm@pobox.com", >> "configGlossary:poweredBy": "Cofax", >> "configGlossary:poweredByIcon": "/images/cofax.gif", >> "configGlossary:staticPath": "/content/static", >> "templateProcessorClass": "org.cofax.WysiwygTemplate", >> "templateLoaderClass": "org.cofax.FilesTemplateLoader", >> "templatePath": "templates", >> "templateOverridePath": "", >> "defaultListTemplate": "listTemplate.htm", >> "defaultFileTemplate": "articleTemplate.htm", >> "useJSP": false, >> "jspListTemplate": "listTemplate.jsp", >> "jspFileTemplate": "articleTemplate.jsp", >> "cachePackageTagsTrack": 200, >> "cachePackageTagsStore": 200, >> "cachePackageTagsRefresh": 60, >> "cacheTemplatesTrack": 100, >> "cacheTemplatesStore": 50, >> "cacheTemplatesRefresh": 15, >> "cachePagesTrack": 200, >> "cachePagesStore": 100, >> "cachePagesRefresh": 10, >> "cachePagesDirtyRead": 10, >> "searchEngineListTemplate": "forSearchEnginesList.htm", >> "searchEngineFileTemplate": "forSearchEngines.htm", >> "searchEngineRobotsDb": "WEB-INF/robots.db", >> "useDataStore": true, >> "dataStoreClass": "org.cofax.SqlDataStore", >> "redirectionClass": "org.cofax.SqlRedirection", >> "dataStoreName": "cofax", >> "dataStoreDriver": = "com.microsoft.jdbc.sqlserver.SQLServerDriver", >> "dataStoreUrl": = "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=3Dgoon", >> "dataStoreUser": "sa", >> "dataStorePassword": "dataStoreTestQuery", >> "dataStoreTestQuery": "SET NOCOUNT ON;select test=3D'test';", >> "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log", >> "dataStoreInitConns": 10, >> "dataStoreMaxConns": 100, >> "dataStoreConnUsageLimit": 100, >> "dataStoreLogLevel": "debug", >> "maxUrlLength": 500}}, >> { >> "servlet-name": "cofaxEmail", >> "servlet-class": "org.cofax.cds.EmailServlet", >> "init-param": { >> "mailHost": "mail1", >> "mailHostOverride": "mail2"}}, >> { >> "servlet-name": "cofaxAdmin", >> "servlet-class": "org.cofax.cds.AdminServlet"}, >> { >> "servlet-name": "fileServlet", >> "servlet-class": "org.cofax.cds.FileServlet"}, >> { >> "servlet-name": "cofaxTools", >> "servlet-class": "org.cofax.cms.CofaxToolsServlet", >> "init-param": { >> "templatePath": "toolstemplates/", >> "log": 1, >> "logLocation": "/usr/local/tomcat/logs/CofaxTools.log", >> "logMaxSize": "", >> "dataLog": 1, >> "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log", >> "dataLogMaxSize": "", >> "removePageCache": "/content/admin/remove?cache=3Dpages&id=3D",= >> "removeTemplateCache": = "/content/admin/remove?cache=3Dtemplates&id=3D", >> "fileTransferFolder": = "/usr/local/tomcat/webapps/content/fileTransferFolder", >> "lookInContext": 1, >> "adminGroupID": 4, >> "betaServer": true}}], >> "servlet-mapping": { >> "cofaxCDS": "/", >> "cofaxEmail": "/cofaxutil/aemail/*", >> "cofaxAdmin": "/admin/*", >> "fileServlet": "/static/*", >> "cofaxTools": "/tools/*"}, >> "taglib": { >> "taglib-uri": "cofax.tld", >> "taglib-location": "/WEB-INF/tlds/cofax.tld"}}} >> -------------- >>=20 >>=20 >> { >> "firstName": "John", >> "lastName": "Smith", >> "isAlive": true, >> "age": 25, >> "height_cm": 167.6, >> "address": { >> "streetAddress": "21 2nd Street", >> "city": "New York", >> "state": "NY", >> "postalCode": "10021-3100" >> }, >> "phoneNumbers": [ >> { >> "type": "home", >> "number": "212 555-1234" >> }, >> { >> "type": "office", >> "number": "646 555-4567" >> } >> ], >> "children": [], >> "spouse": null >> } >>=20 >> -------------- >>=20 >> {"menu": { >> "id": "file", >> "value": "File", >> "popup": { >> "menuitem": [ >> {"value": "New", "onclick": "CreateNewDoc()"}, >> {"value": "Open", "onclick": "OpenDoc()"}, >> {"value": "Close", "onclick": "CloseDoc()"} >> ] >> } >> }} >>=20 >> -------------- >>=20 >> {"menu": { >> "header": "SVG Viewer", >> "items": [ >> {"id": "Open"}, >> {"id": "OpenNew", "label": "Open New"}, >> null, >> {"id": "ZoomIn", "label": "Zoom In"}, >> {"id": "ZoomOut", "label": "Zoom Out"}, >> {"id": "OriginalView", "label": "Original View"}, >> null, >> {"id": "Quality"}, >> {"id": "Pause"}, >> {"id": "Mute"}, >> null, >> {"id": "Find", "label": "Find..."}, >> {"id": "FindAgain", "label": "Find Again"}, >> {"id": "Copy"}, >> {"id": "CopyAgain", "label": "Copy Again"}, >> {"id": "CopySVG", "label": "Copy SVG"}, >> {"id": "ViewSVG", "label": "View SVG"}, >> {"id": "ViewSource", "label": "View Source"}, >> {"id": "SaveAs", "label": "Save As"}, >> null, >> {"id": "Help"}, >> {"id": "About", "label": "About Adobe CVG Viewer..."} >> ] >> }} >>=20 >> -------------- >>=20 >> [/!] >>=20 >> { >> "ref":1, >> "glossary": { >> "title": "example glossary", >> "GlossDiv": { >> "title": "S", >> "GlossList": { >> "GlossEntry": { >> "ID": "SGML", >> "SortAs": "SGML", >> "GlossTerm": "Standard = Generalized Markup Language", >> "Acronym": "SGML", >> "Abbrev": "ISO 8879:1986", >> "GlossDef": { >> "para": "A meta-markup language, used to = create markup languages such as DocBook.", >> "GlossSeeAlso": ["GML", = "XML"] >> }, >> "GlossSee": "markup" >> } >> } >> } >> } >> } >>=20 >> -------------- >>=20 >>=20 >> { "PONumber" : 1600, >> "Reference" : "ABULL-20140421", >> "Requestor" : "Alexis Bull", >> "User" : "ABULL", >> "CostCenter" : "A50", >> "ShippingInstructions" : { "name" : "Alexis Bull", >> "Address": { "street" : "200 Sporting = Green", >> "city" : "South San = Francisco", >> "state" : "CA", >> "zipCode" : 99236, >> "country" : "United States = of America" }, >> "Phone" : [ { "type" : "Office", = "number" : "909-555-7307" }, >> { "type" : "Mobile", = "number" : "415-555-1234" } ] }, >> "Special Instructions" : null, >> "AllowPartialShipment" : false, >> "LineItems" : [ { "ItemNumber" : 1, >> "Part" : { "Description" : "One = Magic Christmas", >> "UnitPrice" : = 19.95, >> "UPCCode" : = 13131092899 }, >> "Quantity" : 9.0 }, >> { "ItemNumber" : 2, >> "Part" : { "Description" : = "Lethal Weapon", >> "UnitPrice" : = 19.95, >> "UPCCode" : = 85391628927 }, >> "Quantity" : 5.0 } ] } >>=20 >> -------------- >>=20 >>=20 >> The new cell will be available with the fastCGI next week, OSX and = linux (64bit) versions. >> We will be interest to read your comments about it and to listen to = your ideas, your needs or your comments. >>=20 >> - chris >>=20 >>=20 >>=20 >>=20 >> --------------------------------------------------------- >> This message is sent to you because you are subscribed to >> the mailing list . >> To unsubscribe, E-mail to: >> archives: http://mail.webdna.us/list/talk@webdna.us >> Bug Reporting: support@webdna.us >>=20 >=20 > --=20 > Jym Duane - CTO - Purpose Media > Creating Your Success Story > Marketing : Television - Internet -Print > Phone: (877) 443-1323 > Email: jym@purposemedia.com > Web: www.purposemedia.com >=20 > Oregon - www.GuideToOregon.com > PO Box 1725, Jacksonville, OR 97530 >=20 > California - www.OrangeCounty.net > PO Box 2025, Capistrano Beach, CA 92624 >=20 >=20 >=20 > --------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us > Bug Reporting: support@webdna.us Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] JSON objects and [JSONstore]: new cell (christophe.billiottet@webdna.us 2014)
  2. Re: [WebDNA] JSON objects and [JSONstore]: new cell (Jym Duane 2014)
  3. [WebDNA] JSON objects and [JSONstore]: new cell (christophe.billiottet@webdna.us 2014)
The new [JSONstore] is available on the v.8 fastCGI version for linux = and OSX. http://www.webdna.us/page.dna?numero=3D307 - chris On Sep 25, 2014, at 22:00, Jym Duane wrote: > looks like an excellent addition. >=20 > jym >=20 >=20 > On 9/25/2014 5:07 AM, christophe.billiottet@webdna.us wrote: >> Because more and more websites are relying on javascript (browser = side), we have decided to give WebDNA a tool to store complex JSON = objects into a flat database. >>=20 >> JSON object and XML format have more or less the same structure, = however XML specification does not match the data model for most = programming languages which makes it slow and tedious for programmers to = parse. Compared to JSON, XML has a low data-to-markup ratio which = results in it being more difficult for humans to read and write. JSON = standard is language-independent and its data structures, arrays and = objects, are universally recognized. These structures are supported in = some way by nearly all modern programming languages and are familiar to = nearly all programmers. These qualities make it an ideal format for data = interchange on the web. It handles different types of data: numbers, = strings, boolean, arrays=85 The problem relies in JSON objects structure = that can be complicated to handle as it can include other nested = objects, arrays, arrays with objects, objects with nested arrays, = objects with nested objects, object with nested arrays and objects=85 a = number of structures that are difficult to recognize and parse and even = more complicated to store. >>=20 >> The no-sql is one answer. I already explained here how to use WebDNA = as no-sql database, each JSON object being stored as a text file indexed = into a WebDNA database. >>=20 >> We went one step further and built a new tag, a =93cell=94 = [JSONstore] that can analyze, recognize, parse and store JSON object = into our usual WebDNA flat database. We made it solid and = stucture-independant. >>=20 >> So, let=92s see an example of a JSON Object with a nested array; this = should not be too difficult for a human to read >>=20 >> var myObject =3D { >> "first": "John", >> "last": "Doe", >> "age": 39, >> "interests": [ "Reading", "Mountain Biking", "Hacking" ], >> "favorites": { >> "color": "Blue", >> "sport": "Soccer", >> "food": "Spaghetti" >> }, >> "skills": [ >> { >> "category": "JavaScript", >> "tests": [ >> { "name": "One", "score": 90 }, >> { "name": "Two", "score": 96 } >> ] >> }, >> { >> "category": "CouchDB", >> "tests": [ >> { "name": "One", "score": 79 }, >> { "name": "Two", "score": 84 } >> ] >> }, >> { >> =93category": "WebDNA", >> "tests": [ >> { "name": "One", "score": 97 }, >> { "name": "Two", "score": 93 } >> ] >> } >> ] >> } >>=20 >>=20 >>=20 >>=20 >> We will make WebDNA store it in a flat database: simple data go the = usual way, like >>=20 >> first=3DJohn >> last=3DDoe >> age=3D39 >>=20 >> arrays will have a field with =93:array=94 appended to the field name = so WebDNA knows it is an array and that the content should not be = parsed. >>=20 >> interests:array=3D=93Reading=94,=93Mountain Biking=94,=93Hacking=94 >>=20 >> skills:array=3D{=93category=94:=94JavaScript=94,=94tests=94:[{=93name=94= :=94One", "score":90},{"name": "Two", "score": 96 = }]},{"category":"CouchDB","tests":[{"name":"One","score":79},{"name":"Two"= ,"score":84 }]}, = {=93category":"WebDNA",=93tests=94:[{"name":"One","score":97},{"name":"Two= ","score":93} >>=20 >> nested objects will be parsed and stored by appending the second = level field name to the first one, separated by a colon >>=20 >> favorites:color=3Dblue >> favorite:sport=3DSoccer >> favorite:food=3DSpaghetti >>=20 >>=20 >>=20 >> So, how to do that? first by preparing your database: it will include = these fields >>=20 >> firstlastageinterests:arrayfavorites:color= favorite:sport favorite:food skills:array >>=20 >> Then, using the new cell [JSONstore] and the database name >>=20 >> [JSONstore db=3Dwhatever.db] >> >> [/JSONstore] >>=20 >> (a debug=3Don option is available to know exactly what and how it is = stored) >>=20 >> by replacing by the actual object, the cell [JSONstore] = will populate the database like this, automatically >>=20 >> first=3DJohn >> last=3DDoe >> age=3D39 >> interests:array=3D=93Reading=94, =93Mountain Biking", "Hacking" >> favorites:color=3DBlue >> favorites:sport=3DSoccer >> favorites:food=3DSpaghetti >> skills:array=3D{ "category": "JavaScript", "tests": [ { "name": = "One", "score": 90 }, { "name": "Two", "score": 96 } ] }, { "category": = "CouchDB", "tests": [ { "name": "One", "score": 79 }, { "name": "Two", = "score": 84 } ] }, { "category": "WebDNA", "tests": [ { "name": "One", = "score": 97 }, { "name": "Two", "score": 93 } ] } >>=20 >> Sorting the data to recompose the original object is straightforward >>=20 >> { >> =93first=94: =93[first]", >> =93last=94: "[last]", >> =93interests=94: [interest:array], >> "favorites": { >> =93color=94: =93[favorite:color]=94, >> =93food=94: =93[favorite:food]" >> =93sport=94: =93[favorite:sport]" >> } >> =93skills=94: [skills:array] >> } >>=20 >>=20 >> JQUERY, for instance, will work well with it. >>=20 >> This has been tested against the following examples, some of them = being somewhat difficult to work with. >>=20 >>=20 >>=20 >>=20 >> -------------- >> { "accounting" : [ >> { "firstName" : "John", >> "lastName" : "Doe", >> "age" : 23 }, >> { "firstName" : "Mary", >> "lastName" : "Smith", >> "age" : 32 } >> ], >> "sales" : [ >> { "firstName" : "Sally", >> "lastName" : "Green", >> "age" : 27 }, >> { "firstName" : "Jim", >> "lastName" : "Galley", >> "age" : 41 } >> ] >> } >> -------------- >> { >> "problems": [{ >> "Diabetes":[{ >> "medications":[{ >> "medicationsClasses":[{ >> "className":[{ >> "associatedDrug":[{ >> "name":"asprin", >> "dose":"", >> "strength":"500 mg" >> }], >> "associatedDrug#2":[{ >> "name":"somethingElse", >> "dose":"", >> "strength":"500 mg" >> }] >> }], >> "className2":[{ >> "associatedDrug":[{ >> "name":"asprin", >> "dose":"", >> "strength":"500 mg" >> }], >> "associatedDrug#2":[{ >> "name":"somethingElse", >> "dose":"", >> "strength":"500 mg" >> }] >> }] >> }] >> }], >> "labs":[{ >> "" >> }] >> }], >> "Asthma":[{}] >> }] >> } >> -------------- >> { >> "medications":[{ >> "aceInhibitors":[{ >> "name":"lisinopril", >> "strength":"10 mg Tab", >> "dose":"1 tab", >> "route":"PO", >> "sig":"daily", >> "pillCount":"#90", >> "refills":"Refill 3" >> }], >> "antianginal":[{ >> "name":"nitroglycerin", >> "strength":"0.4 mg Sublingual Tab", >> "dose":"1 tab", >> "route":"SL", >> "sig":"q15min PRN", >> "pillCount":"#30", >> "refills":"Refill 1" >> }], >> "anticoagulants":[{ >> "name":"warfarin sodium", >> "strength":"3 mg Tab", >> "dose":"1 tab", >> "route":"PO", >> "sig":"daily", >> "pillCount":"#90", >> "refills":"Refill 3" >> }], >> "betaBlocker":[{ >> "name":"metoprolol tartrate", >> "strength":"25 mg Tab", >> "dose":"1 tab", >> "route":"PO", >> "sig":"daily", >> "pillCount":"#90", >> "refills":"Refill 3" >> }], >> "diuretic":[{ >> "name":"furosemide", >> "strength":"40 mg Tab", >> "dose":"1 tab", >> "route":"PO", >> "sig":"daily", >> "pillCount":"#90", >> "refills":"Refill 3" >> }], >> "mineral":[{ >> "name":"potassium chloride ER", >> "strength":"10 mEq Tab", >> "dose":"1 tab", >> "route":"PO", >> "sig":"daily", >> "pillCount":"#90", >> "refills":"Refill 3" >> }] >> } >> ], >> "labs":[{ >> "name":"Arterial Blood Gas", >> "time":"Today", >> "location":"Main Hospital Lab" >> }, >> { >> "name":"BMP", >> "time":"Today", >> "location":"Primary Care Clinic" >> }, >> { >> "name":"BNP", >> "time":"3 Weeks", >> "location":"Primary Care Clinic" >> }, >> { >> "name":"BUN", >> "time":"1 Year", >> "location":"Primary Care Clinic" >> }, >> { >> "name":"Cardiac Enzymes", >> "time":"Today", >> "location":"Primary Care Clinic" >> }, >> { >> "name":"CBC", >> "time":"1 Year", >> "location":"Primary Care Clinic" >> }, >> { >> "name":"Creatinine", >> "time":"1 Year", >> "location":"Main Hospital Lab" >> }, >> { >> "name":"Electrolyte Panel", >> "time":"1 Year", >> "location":"Primary Care Clinic" >> }, >> { >> "name":"Glucose", >> "time":"1 Year", >> "location":"Main Hospital Lab" >> }, >> { >> "name":"PT/INR", >> "time":"3 Weeks", >> "location":"Primary Care Clinic" >> }, >> { >> "name":"PTT", >> "time":"3 Weeks", >> "location":"Coumadin Clinic" >> }, >> { >> "name":"TSH", >> "time":"1 Year", >> "location":"Primary Care Clinic" >> } >> ], >> "imaging":[{ >> "name":"Chest X-Ray", >> "time":"Today", >> "location":"Main Hospital Radiology" >> }, >> { >> "name":"Chest X-Ray", >> "time":"Today", >> "location":"Main Hospital Radiology" >> }, >> { >> "name":"Chest X-Ray", >> "time":"Today", >> "location":"Main Hospital Radiology" >> } >> ] >> } >>=20 >> -------------- >>=20 >> { >> "first": "John", >> "skills": [{ >> "Diabetes":[{ >> "medications":[{ >> "medicationsClasses":[{ >> "className":[{ >> "associatedDrug":[{ >> "name":"asprin", >> "dose":"", >> "strength":"500 mg" >> }], >> "associatedDrug#2":[{ >> "name":"somethingElse", >> "dose":"", >> "strength":"500 mg" >> }] >> }], >> "className2":[{ >> "associatedDrug":[{ >> "name":"asprin", >> "dose":"", >> "strength":"500 mg" >> }], >> "associatedDrug#2":[{ >> "name":"somethingElse", >> "dose":"", >> "strength":"500 mg" >> }] >> }] >> }] >> }], >> "labs":[{ >> "" >> }] >> }], >> "Asthma":[{}] >> }] >> } >>=20 >> -------------- >>=20 >> {"widget": { >> "debug": "on", >> "window": { >> "title": "Sample Konfabulator Widget", >> "name": "main_window", >> "width": 500, >> "height": 500 >> }, >> "image": { >> "src": "Images/Sun.png", >> "name": "sun1", >> "hOffset": 250, >> "vOffset": 250, >> "alignment": "center" >> }, >> "text": { >> "data": "Click Here", >> "size": 36, >> "style": "bold", >> "name": "text1", >> "hOffset": 250, >> "vOffset": 100, >> "alignment": "center", >> "onMouseUp": "sun1.opacity =3D (sun1.opacity / 100) * 90;" >> } >> }} >>=20 >> -------------- >>=20 >> { >> "ref":1, >> "glossary": { >> "title": "example glossary", >> "GlossDiv": { >> "title": "S", >> "GlossList": { >> "GlossEntry": { >> "ID": "SGML", >> "SortAs": "SGML", >> "GlossTerm": "Standard = Generalized Markup Language", >> "Acronym": "SGML", >> "Abbrev": "ISO 8879:1986", >> "GlossDef": { >> "para": "A meta-markup language, used to = create markup languages such as DocBook.", >> "GlossSeeAlso": ["GML", = "XML"] >> }, >> "GlossSee": "markup" >> } >> } >> } >> } >> } >>=20 >> -------------- >>=20 >> {"web-app": { >> "servlet": [ >> { >> "servlet-name": "cofaxCDS", >> "servlet-class": "org.cofax.cds.CDSServlet", >> "init-param": { >> "configGlossary:installationAt": "Philadelphia, PA", >> "configGlossary:adminEmail": "ksm@pobox.com", >> "configGlossary:poweredBy": "Cofax", >> "configGlossary:poweredByIcon": "/images/cofax.gif", >> "configGlossary:staticPath": "/content/static", >> "templateProcessorClass": "org.cofax.WysiwygTemplate", >> "templateLoaderClass": "org.cofax.FilesTemplateLoader", >> "templatePath": "templates", >> "templateOverridePath": "", >> "defaultListTemplate": "listTemplate.htm", >> "defaultFileTemplate": "articleTemplate.htm", >> "useJSP": false, >> "jspListTemplate": "listTemplate.jsp", >> "jspFileTemplate": "articleTemplate.jsp", >> "cachePackageTagsTrack": 200, >> "cachePackageTagsStore": 200, >> "cachePackageTagsRefresh": 60, >> "cacheTemplatesTrack": 100, >> "cacheTemplatesStore": 50, >> "cacheTemplatesRefresh": 15, >> "cachePagesTrack": 200, >> "cachePagesStore": 100, >> "cachePagesRefresh": 10, >> "cachePagesDirtyRead": 10, >> "searchEngineListTemplate": "forSearchEnginesList.htm", >> "searchEngineFileTemplate": "forSearchEngines.htm", >> "searchEngineRobotsDb": "WEB-INF/robots.db", >> "useDataStore": true, >> "dataStoreClass": "org.cofax.SqlDataStore", >> "redirectionClass": "org.cofax.SqlRedirection", >> "dataStoreName": "cofax", >> "dataStoreDriver": = "com.microsoft.jdbc.sqlserver.SQLServerDriver", >> "dataStoreUrl": = "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=3Dgoon", >> "dataStoreUser": "sa", >> "dataStorePassword": "dataStoreTestQuery", >> "dataStoreTestQuery": "SET NOCOUNT ON;select test=3D'test';", >> "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log", >> "dataStoreInitConns": 10, >> "dataStoreMaxConns": 100, >> "dataStoreConnUsageLimit": 100, >> "dataStoreLogLevel": "debug", >> "maxUrlLength": 500}}, >> { >> "servlet-name": "cofaxEmail", >> "servlet-class": "org.cofax.cds.EmailServlet", >> "init-param": { >> "mailHost": "mail1", >> "mailHostOverride": "mail2"}}, >> { >> "servlet-name": "cofaxAdmin", >> "servlet-class": "org.cofax.cds.AdminServlet"}, >> { >> "servlet-name": "fileServlet", >> "servlet-class": "org.cofax.cds.FileServlet"}, >> { >> "servlet-name": "cofaxTools", >> "servlet-class": "org.cofax.cms.CofaxToolsServlet", >> "init-param": { >> "templatePath": "toolstemplates/", >> "log": 1, >> "logLocation": "/usr/local/tomcat/logs/CofaxTools.log", >> "logMaxSize": "", >> "dataLog": 1, >> "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log", >> "dataLogMaxSize": "", >> "removePageCache": "/content/admin/remove?cache=3Dpages&id=3D",= >> "removeTemplateCache": = "/content/admin/remove?cache=3Dtemplates&id=3D", >> "fileTransferFolder": = "/usr/local/tomcat/webapps/content/fileTransferFolder", >> "lookInContext": 1, >> "adminGroupID": 4, >> "betaServer": true}}], >> "servlet-mapping": { >> "cofaxCDS": "/", >> "cofaxEmail": "/cofaxutil/aemail/*", >> "cofaxAdmin": "/admin/*", >> "fileServlet": "/static/*", >> "cofaxTools": "/tools/*"}, >> "taglib": { >> "taglib-uri": "cofax.tld", >> "taglib-location": "/WEB-INF/tlds/cofax.tld"}}} >> -------------- >>=20 >>=20 >> { >> "firstName": "John", >> "lastName": "Smith", >> "isAlive": true, >> "age": 25, >> "height_cm": 167.6, >> "address": { >> "streetAddress": "21 2nd Street", >> "city": "New York", >> "state": "NY", >> "postalCode": "10021-3100" >> }, >> "phoneNumbers": [ >> { >> "type": "home", >> "number": "212 555-1234" >> }, >> { >> "type": "office", >> "number": "646 555-4567" >> } >> ], >> "children": [], >> "spouse": null >> } >>=20 >> -------------- >>=20 >> {"menu": { >> "id": "file", >> "value": "File", >> "popup": { >> "menuitem": [ >> {"value": "New", "onclick": "CreateNewDoc()"}, >> {"value": "Open", "onclick": "OpenDoc()"}, >> {"value": "Close", "onclick": "CloseDoc()"} >> ] >> } >> }} >>=20 >> -------------- >>=20 >> {"menu": { >> "header": "SVG Viewer", >> "items": [ >> {"id": "Open"}, >> {"id": "OpenNew", "label": "Open New"}, >> null, >> {"id": "ZoomIn", "label": "Zoom In"}, >> {"id": "ZoomOut", "label": "Zoom Out"}, >> {"id": "OriginalView", "label": "Original View"}, >> null, >> {"id": "Quality"}, >> {"id": "Pause"}, >> {"id": "Mute"}, >> null, >> {"id": "Find", "label": "Find..."}, >> {"id": "FindAgain", "label": "Find Again"}, >> {"id": "Copy"}, >> {"id": "CopyAgain", "label": "Copy Again"}, >> {"id": "CopySVG", "label": "Copy SVG"}, >> {"id": "ViewSVG", "label": "View SVG"}, >> {"id": "ViewSource", "label": "View Source"}, >> {"id": "SaveAs", "label": "Save As"}, >> null, >> {"id": "Help"}, >> {"id": "About", "label": "About Adobe CVG Viewer..."} >> ] >> }} >>=20 >> -------------- >>=20 >> [/!] >>=20 >> { >> "ref":1, >> "glossary": { >> "title": "example glossary", >> "GlossDiv": { >> "title": "S", >> "GlossList": { >> "GlossEntry": { >> "ID": "SGML", >> "SortAs": "SGML", >> "GlossTerm": "Standard = Generalized Markup Language", >> "Acronym": "SGML", >> "Abbrev": "ISO 8879:1986", >> "GlossDef": { >> "para": "A meta-markup language, used to = create markup languages such as DocBook.", >> "GlossSeeAlso": ["GML", = "XML"] >> }, >> "GlossSee": "markup" >> } >> } >> } >> } >> } >>=20 >> -------------- >>=20 >>=20 >> { "PONumber" : 1600, >> "Reference" : "ABULL-20140421", >> "Requestor" : "Alexis Bull", >> "User" : "ABULL", >> "CostCenter" : "A50", >> "ShippingInstructions" : { "name" : "Alexis Bull", >> "Address": { "street" : "200 Sporting = Green", >> "city" : "South San = Francisco", >> "state" : "CA", >> "zipCode" : 99236, >> "country" : "United States = of America" }, >> "Phone" : [ { "type" : "Office", = "number" : "909-555-7307" }, >> { "type" : "Mobile", = "number" : "415-555-1234" } ] }, >> "Special Instructions" : null, >> "AllowPartialShipment" : false, >> "LineItems" : [ { "ItemNumber" : 1, >> "Part" : { "Description" : "One = Magic Christmas", >> "UnitPrice" : = 19.95, >> "UPCCode" : = 13131092899 }, >> "Quantity" : 9.0 }, >> { "ItemNumber" : 2, >> "Part" : { "Description" : = "Lethal Weapon", >> "UnitPrice" : = 19.95, >> "UPCCode" : = 85391628927 }, >> "Quantity" : 5.0 } ] } >>=20 >> -------------- >>=20 >>=20 >> The new cell will be available with the fastCGI next week, OSX and = linux (64bit) versions. >> We will be interest to read your comments about it and to listen to = your ideas, your needs or your comments. >>=20 >> - chris >>=20 >>=20 >>=20 >>=20 >> --------------------------------------------------------- >> This message is sent to you because you are subscribed to >> the mailing list . >> To unsubscribe, E-mail to: >> archives: http://mail.webdna.us/list/talk@webdna.us >> Bug Reporting: support@webdna.us >>=20 >=20 > --=20 > Jym Duane - CTO - Purpose Media > Creating Your Success Story > Marketing : Television - Internet -Print > Phone: (877) 443-1323 > Email: jym@purposemedia.com > Web: www.purposemedia.com >=20 > Oregon - www.GuideToOregon.com > PO Box 1725, Jacksonville, OR 97530 >=20 > California - www.OrangeCounty.net > PO Box 2025, Capistrano Beach, CA 92624 >=20 >=20 >=20 > --------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us > Bug Reporting: support@webdna.us christophe.billiottet@webdna.us

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Error with [applescript] (1999) WebCat2: Found Items syntax, etc. (1997) Close-to Comparison Code (1998) off topic - dna snipets (1997) Major Security Hole (1998) Show next 2 examples that work (1997) Webcatalog error, Plug-in for Webstar (1996) Help!!!! (1999) Another question (1997) cybercash (1997) default value from Lookup (was Grant, please help me) (1997) Forcing Search w/ URL (1999) BW in a search (2007) Adding a product from another site (1997) possible, WebCat2.0 and checkboxes-restated (1997) PCS Frames (1997) searching by date range help needed (1997) TEXTAREA and sendmail (1998) WebCat2 Append problem (B14Macacgi) (1997) Thanks ! (1997)