Gets the typed value of a named property from the JSON object.
This viper method also supports the extension viper syntax.
Syntax
Smartsite SXML | Copy Code |
---|---|
any this.getvalue(string name) |
Extension Viper Syntax
Smartsite SXML | Copy Code |
---|---|
any page.<id>.getvalue(string name) |
Parameters
Name | Data Type | Description |
---|---|---|
name | String | The name of the property. Use the . operator to query within nested objects. |
Return Value
Data Type | Description |
---|---|
Any | The typed value of the property |
Used in
Macro | Description |
---|---|
Json | The JSON macro can parse a JSON string. It exposes properties to query the resulting object and methods to modify it. |
Examples
Smartlet Example
Here's a largish example of a working smartlet. It's described in more detail here.
Smartsite SXML | Copy Code |
---|---|
<se:switch expression="translation.arg(1,rem='Use "init" to add all the plumbing to your form, "set" to get the value of a control taking the zip code from posted data.')" > <se:case value="init"> {buffer.set('formId',translation.arg(2,rem='Id of the enriched form'))} {buffer.set('zipControl',translation.arg(3,rem='Name of the zip code control'))} {buffer.set('streetControl',translation.arg(4,rem='Name of the street control for mode init, name of the requested value for mode set.'))} {buffer.set('cityControl',translation.arg(5,rem='Name of the street control'))} <!--// Initialize javascript for enrichment --> {placeholder.addjavascriptonload("$get('addrInvulKnop').style.display='none';")} {placeholder.addjavascriptonload("$addHandler(getZip(), 'change', PostWebRequest);")} <se:placeholder.addjavascriptinclude url="/AJAX/Scripts/MicrosoftAjax.js" /> <se:placeholder.addjavascriptinclude url="/AJAX/Scripts/MicrosoftAjaxWebForms.js" /> <se:placeholder.addjavascriptinclude url="/AJAX/Scripts/Toolkit/Common.js" /> <se:placeholder.addjavascriptinclude url="/AJAX/Scripts/Toolkit/BaseScripts.js" /> <se:placeholder.addjavascriptinclude url="{channel.link('JS_ZIPCODE')}" /> <se:placeholder.addjavascript> function getZip(){ return $get("{buffer.get('formId')}").elements["{buffer.get('zipControl')}"]; } function getStreet(){ return $get("{buffer.get('formId')}").elements["{buffer.get('streetControl')}"]; } function getCity(){ return $get("{buffer.get('formId')}").elements["{buffer.get('cityControl')}"]; } // This function performs a POST Web request. function PostWebRequest() { pwr("{channel.link(translation.number())}"); } </se:placeholder.addjavascript> <input type="submit" id="addrInvulKnop" name="updateAddress" value="Adres invullen" /> </se:case> <se:case value="set" whitespace="remove"> {buffer.set('zipControl',translation.arg(3,rem='Name of the zip code control'))} <!--// TODO: Harden against SQL injection --> {buffer.set('requestedValue',translation.arg(4,rem='Name of the street control for mode init, name of the requested value for mode set.'))} <se:sqlquery condition="request.form(buffer.get('zipControl'),default='')!=''" sql="select {buffer.get('requestedValue',whitespace='normalize')} from zipcodes where zipcode='{request.form(buffer.get(zipControl))}'"> <se:parameters> <se:parameter name="rowformat">{this.field(1)}</se:parameter> </se:parameters> </se:sqlquery> </se:case> <se:case whitespace="remove"> <!--// Handle postback --> <se:json /> <se:if expression="page.json.exists('zip')"> <se:then> <se:sqlquery whitespace="preserve"> <se:parameters> <se:parameter name="sql"> select street, city from zipcodes where zipcode=? </se:parameter> <se:parameter name="params">{page.json.getvalue('zip')}</se:parameter> <se:parameter name="format"> <se:rowformat match="first">"city":"{this.field(city)}","street":"{this.field(street)}"</se:rowformat> <se:rowformat></se:rowformat> </se:parameter> <se:parameter name="resultformat">{{this.result()}}</se:parameter> </se:parameters> </se:sqlquery> {response.contenttype('application/json')} </se:then> <se:else> {response.redirect(4216)} </se:else> </se:if> </se:case> </se:switch> |
Smartsite SXML | Copy Code |
---|---|
<se:json localid="example"> {"count":10,"name":"Seneca","foo":{"name":"foo","list":[1,2,3]}} </se:json> {scope.example.getjsontypename(name)}: {sxml.gettypename(scope.example.getvalue(name))}: {scope.example.getvalue(name)} {scope.example.getjsontypename("foo.list.0")}: {sxml.gettypename(scope.example.getvalue("foo.list.0"))}: {scope.example.getvalue("foo.list.0")} |
- Macro
- Macro Parameters
- Macro Parameter Properties
-
Vipers
- Global Viper Methods
-
Local Viper Methods
- This.Add (Json) Viper Method
- This.Add (Metadata) Viper Method
- This.Add (PlaceHolder) Viper Method
- This.Add (ShoppingCart) Viper Method
- This.AddDublinCore (Metadata) Viper Method
- This.AddLine Viper Method
- This.AddNamespace (Metadata) Viper Method
- This.AddNull (Json) Viper Method
- This.AddValue (Json) Viper Method
- This.AffectedRecords (SqlQuery) Viper Method
- This.AIM.Relations Viper Method
- This.Allowemptysearch (FacetedSearchQueryBuilder20) Viper Method
- This.AltText (Image) Viper Method
- This.Amount (Payment) Viper Method
- This.Append Viper Method
- This.AppendChild (XmlProcessor) Viper Method
- This.AppendChildBinary (XmlProcessor) Viper Method
- This.AppendChildXml (XmlProcessor) Viper Method
- This.ApplyBoxFormat (SmartletBox) Viper Method
- This.Attribs (SmartletBox) Viper Method
- This.AutoTitle (Image) Viper Method
- This.BoxData (SmartletBox) Viper Method
- This.BoxMode (SmartletBox) Viper Method
- This.BoxSkin (SmartletBox) Viper Method
- This.Brand (Payment) Viper Method
- This.Break (For) Viper Method
- This.Break Viper Method
- This.Buffer.Exists Viper Method
- This.Buffer.Get Viper Method
- This.Buffer.Set Viper Method
- This.Buttons (SmartletBox) Viper Method
- This.CanGoBack (Paging) Viper Method
- This.CanGoForward (Paging) Viper Method
- This.Caption (SmartletBox) Viper Method
- This.ChildLevelResult Viper Method
- This.ClassName (Image) Viper Method
- This.Clear Viper Method
- This.ClearDublinCore (Metadata) Viper Method
- This.ClearForcedResult Viper Method
- This.ColCount Viper Method
- This.ColName Viper Method
- This.ColNumber Viper Method
- This.CompleteDocument Viper Method
- This.ContentTypeWeight (FacetedSearchQueryBuilder) Viper Method
- This.ContentTypeWeight (FacetedSearchQueryBuilder20) Viper Method
- This.Count (Paging) Viper Method
- This.Currency (Payment) Viper Method
- This.Current (Paging) Viper Method
- This.CurrentIndex (Siblings) Viper Method
- This.CustomerAddress (Payment) Viper Method
- This.CustomerCountry (Payment) Viper Method
- This.CustomerEmail (Payment) Viper Method
- This.CustomerName (Payment) Viper Method
- This.CustomerPhone (Payment) Viper Method
- This.CustomerTown (Payment) Viper Method
- This.CustomerZipcode (Payment) Viper Method
- This.Data (ViewSource) Viper Method
- This.Data Viper Method
- This.DefaultResultFormat (XLinks) Viper Method
- This.DefaultRowFormat (XLinks) Viper Method
- This.Delete (XmlProcessor) Viper Method
- This.Delete Viper Method
- This.DocTypeHeader Viper Method
- This.DocumentBody Viper Method
- This.DocumentBodyNode Viper Method
- This.EditedSmartlet (SmartletEditor) Viper Method
- This.EditorUseLocation (SmartletEditor) Viper Method
- This.Enable (CacheFile) Viper Method
- This.Error.InnerException.Message Viper Method
- This.Error.InnerException.SmartsiteCode Viper Method
- This.Error.InnerException.Throw Viper Method
- This.Error.InnerException.ToString Viper Method
- This.Error.InnerException.Type Viper Method
- This.Error.Message Viper Method
- This.Error.SmartsiteCode Viper Method
- This.Error.Throw Viper Method
- This.Error.ToString Viper Method
- This.Error.Type Viper Method
- This.Evaluate (XmlProcessor) Viper Method
- This.Exists (Json) Viper Method
- This.Expires Viper Method
- This.ExtractBinary (XmlProcessor) Viper Method
- This.ExtraData (Payment) Viper Method
- This.ExtraElements (SmartletBox) Viper Method
- This.Facet (FacetedSearchQueryBuilder) Viper Method
- This.Facet (FacetedSearchQueryBuilder20) Viper Method
- This.FacetSelectFields (FacetedSearchQueryBuilder) Viper Method
- This.FacetSelectFields (FacetedSearchQueryBuilder20) Viper Method
- This.FacetWhereClause (FacetedSearchQueryBuilder) Viper Method
- This.FacetWhereClause (FacetedSearchQueryBuilder20) Viper Method
- This.Field Viper Method
- This.Field.Exists Viper Method
- This.FieldName (FacetedSearchQueryBuilder) Viper Method
- This.FieldName (FacetedSearchQueryBuilder20) Viper Method
- This.FieldWeight (FacetedSearchQueryBuilder) Viper Method
- This.FieldWeight (FacetedSearchQueryBuilder20) Viper Method
- This.FindExact Viper Method
- This.FindExtension Viper Method
- This.FirstResult (Paging) Viper Method
- This.Footer (SmartletEditor) Viper Method
- This.ForceLayout (FlexLayout) Viper Method
- This.FormAttribs (SmartletBox) Viper Method
- This.FreetextTablesearch (FacetedSearchQueryBuilder20) Viper Method
- This.Get (Json) Viper Method
- This.GetAttribute (XmlProcessor) Viper Method
- This.GetByPosition (Json) Viper Method
- This.GetCacheKey (Cache) Viper Method
- This.getcount (Chart) Viper Method
- This.GetDocType Viper Method
- This.GetEncoded (Json) Viper Method
- This.GetEncodedValue (Json) Viper Method
- This.GetEncoding Viper Method
- This.GetForcedResult Viper Method
- This.GetInnerXml (XmlProcessor) Viper Method
- This.GetJson (Json) Viper Method
- This.GetJsonTypeName (Json) Viper Method
- This.GetJsonTypeName (Json) Viper Method
- This.GetLabel (SmartletEditor) Viper Method
- This.GetLocalNodeName (XmlProcessor) Viper Method
- This.GetMaxYValue (Chart) Viper Method
- This.GetMinYValue (Chart) Viper Method
- This.GetNameByPosition (Json) Viper Method
- This.GetNamespaceUri (XmlProcessor) Viper Method
- This.GetNodeName (XmlProcessor) Viper Method
- This.GetOmitXmlDeclaration (XHtmlPage) Viper Method
- This.GetParameter Viper Method
- This.GetPollItem (Poll) Viper Method
- This.GetPrefix (XmlProcessor) Viper Method
- This.getseriesname (Chart) Viper Method
- This.GetTotalCount (Paging) Viper Method
- This.GetTypedValue (XmlProcessor) Viper Method
- This.GetValue (XmlProcessor) Viper Method
- This.GetValueByPosition (Json) Viper Method
- This.GetXml (XmlProcessor) Viper Method
- This.GoTo (Paging) Viper Method
- This.Group Viper Method
- This.GroupCount Viper Method
- This.GroupNumber Viper Method
- This.GroupResult Viper Method
- This.GroupRowNumber Viper Method
- This.HasUserVoted (Poll) Viper Method
- This.HeadSection Viper Method
- This.Height (SmartletBox) Viper Method
- This.Ignore (CacheFile) Viper Method
- This.ImageId (Image) Viper Method
- This.Index (For) Viper Method
- This.InfoLabel (SmartletEditor) Viper Method
- This.Initialized (Paging) Viper Method
- This.InnerClass (SmartletBox) Viper Method
- This.InsertAfter (XmlProcessor) Viper Method
- This.InsertBefore (XmlProcessor) Viper Method
- This.InsertNodeAfter (XmlProcessor) Viper Method
- This.InsertNodeBefore (XmlProcessor) Viper Method
- This.isActive (Poll) Viper Method
- This.IsBaseQuery (FacetedSearchQueryBuilder) Viper Method
- This.IsBaseQuery (FacetedSearchQueryBuilder20) Viper Method
- This.IsCached (Cache) Viper Method
- This.IsDirectory (Dir) Viper Method
- This.isMultiSelect (Poll) Viper Method
- This.ItemFormat (FeedReader) Viper Method
- This.ItemFormat (SiteMap) Viper Method
- This.JoinClause (FacetedSearchQueryBuilder) Viper Method
- This.JoinClause (FacetedSearchQueryBuilder20) Viper Method
- This.Key.Add (CacheFile) Viper Method
- This.Key.RemoveChannelDependency (CacheFile) Viper Method
- This.LastModified Viper Method
- This.LastResult (Paging) Viper Method
- This.Length (Json) Viper Method
- This.Length Viper Method
- This.Level Viper Method
- This.LevelResult Viper Method
- This.LevelRowNumber Viper Method
- This.Load (Json) Viper Method
- This.Location (Paging) Viper Method
- This.Location Viper Method
- This.MaxRows Viper Method
- This.MimeType (Json) Viper Method
- This.MimeType Viper Method
- This.Mode (FacetedSearchQueryBuilder) Viper Method
- This.Mode (FacetedSearchQueryBuilder20) Viper Method
- This.Name Viper Method
- This.Offset (Paging) Viper Method
- This.OnClick (Image) Viper Method
- This.OrderBy (FacetedSearchQueryBuilder) Viper Method
- This.OrderBy (FacetedSearchQueryBuilder20) Viper Method
- This.OrderId (Payment) Viper Method
- This.OuterClass (SmartletBox) Viper Method
- This.OuterId (SmartletBox) Viper Method
- This.OutputColorDepth (Image) Viper Method
- This.OutputCommandOrder (Image) Viper Method
- This.OutputFileSize (Image) Viper Method
- This.OutputFileType (Image) Viper Method
- This.OutputFrameCount (Image) Viper Method
- This.OutputHeight (Image) Viper Method
- This.OutputLocation (Image) Viper Method
- This.OutputResolutionUnit (Image) Viper Method
- This.OutputResolutionX (Image) Viper Method
- This.OutputResolutionY (Image) Viper Method
- This.OutputStyle (Image) Viper Method
- This.OutputWidth (Image) Viper Method
- This.param Viper Method
- This.ParameterExists Viper Method
- This.ParentLevel (Parents) Viper Method
- This.PaymentMethod (Payment) Viper Method
- This.PopularityWeight (FacetedSearchQueryBuilder) Viper Method
- This.PopularityWeight (FacetedSearchQueryBuilder20) Viper Method
- This.PopulateDatatable (XmlProcessor) Viper Method
- This.PreviewPane (SmartletEditor) Viper Method
- This.Price (ShoppingCart) Viper Method
- This.Products (ShoppingCart) Viper Method
- This.Question (Poll) Viper Method
- This.Rank (Tags) Viper Method
- This.RankingFields (FacetedSearchQueryBuilder) Viper Method
- This.RankingFields (FacetedSearchQueryBuilder20) Viper Method
- This.RankingStatement (FacetedSearchQueryBuilder) Viper Method
- This.RankingStatement (FacetedSearchQueryBuilder20) Viper Method
- This.RawField Viper Method
- This.Redirect (Payment) Viper Method
- This.Remove (Json) Viper Method
- This.Remove (ShoppingCart) Viper Method
- This.RemoveAll (ShoppingCart) Viper Method
- This.RemoveAttribute (XmlProcessor) Viper Method
- This.RemoveNamespace (XmlProcessor) Viper Method
- This.Render (Application) Viper Method
- This.Render Viper Method
- This.Rendered Viper Method
- This.RenderedChannel (References) Viper Method
- This.RenderTime Viper Method
- This.ResponseCookies (EmbedUri) Viper Method
- This.ResponseHeaders (EmbedUri) Viper Method
- This.ResponseHeaders Viper Method
- This.ResponseTime Viper Method
- This.Result Viper Method
- This.Result Viper Method
- This.ResultChannelCode (FacetedSearchQueryBuilder) Viper Method
- This.ResultChannelCode (FacetedSearchQueryBuilder20) Viper Method
- This.ResultChannelJoins (FacetedSearchQueryBuilder) Viper Method
- This.ResultChannelJoins (FacetedSearchQueryBuilder20) Viper Method
- This.RowCount Viper Method
- This.RowNumber Viper Method
- This.RowResult Viper Method
- This.Search Viper Method
- This.SearchCondition (FacetedSearchQueryBuilder) Viper Method
- This.SearchCondition (FacetedSearchQueryBuilder20) Viper Method
- This.SearchGroupViewName (FacetedSearchQueryBuilder) Viper Method
- This.SearchGroupViewName (FacetedSearchQueryBuilder20) Viper Method
- This.SearchQuery (FacetedSearchQueryBuilder) Viper Method
- This.SearchQuery (FacetedSearchQueryBuilder20) Viper Method
- This.SelectFields (FacetedSearchQueryBuilder) Viper Method
- This.SelectFields (FacetedSearchQueryBuilder20) Viper Method
- This.SeoPriority (FacetedSearchQueryBuilder) Viper Method
- This.SeoPriority (FacetedSearchQueryBuilder20) Viper Method
- This.Serial (Payment) Viper Method
- This.Serve (CacheFile) Viper Method
- This.Set (Json) Viper Method
- This.SetAttribute (XmlProcessor) Viper Method
- This.SetCurrentPage (Paging) Viper Method
- This.SetCustomDocType Viper Method
- This.SetDocType Viper Method
- This.SetEncoding Viper Method
- This.SetForcedResult Viper Method
- This.SetInnerXml (XmlProcessor) Viper Method
- This.SetNamespace (XmlProcessor) Viper Method
- This.SetNull (Json) Viper Method
- This.SetOmitXmlDeclaration (XHtmlPage) Viper Method
- This.SetProductCount (ShoppingCart) Viper Method
- This.SetResult (XmlProcessor) Viper Method
- This.SetTotalCount (Paging) Viper Method
- This.SetValue (Json) Viper Method
- This.SetValue (XmlProcessor) Viper Method
- This.SetXmlVersion (XHtmlPage) Viper Method
- This.SiblingCount (Siblings) Viper Method
- This.SiblingExists (Siblings) Viper Method
- This.Size (Dir) Viper Method
- This.Size (Paging) Viper Method
- This.Size Viper Method
- This.Skip (Paging) Viper Method
- This.SkipRows Viper Method
- This.SmartletName (SmartletEditor) Viper Method
- This.Status (Payment) Viper Method
- This.StatusCode Viper Method
- This.Step (For) Viper Method
- This.Summary (Payment) Viper Method
- This.SXMLPath Viper Method
- This.TableOrView (FacetedSearchQueryBuilder) Viper Method
- This.TableOrView (FacetedSearchQueryBuilder20) Viper Method
- This.TaxGroups (ShoppingCart) Viper Method
- This.TaxTotals (ShoppingCart) Viper Method
- This.Title (Dir) Viper Method
- This.Title (Image) Viper Method
- This.Title (SmartletEditor) Viper Method
- This.Title Viper Method
- This.ToDisplay (ShoppingCart) Viper Method
- This.ToString (ShoppingCart) Viper Method
- This.Totals (ShoppingCart) Viper Method
- This.TotalVotes (Poll) Viper Method
- This.ToXml (ShoppingCart) Viper Method
- This.UseBox (SmartletBox) Viper Method
- This.Value (Switch) Viper Method
- This.VisibleRowCount Viper Method
- This.VisibleRowNumber Viper Method
- This.Vote (Poll) Viper Method
- This.WhereClause (FacetedSearchQueryBuilder) Viper Method
- This.WhereClause (FacetedSearchQueryBuilder20) Viper Method
- This.Width (SmartletBox) Viper Method
- This.Xml (XmlProcessor) Viper Method
- This.XmlDeclaration (XHtmlPage) Viper Method
- This.XValue (Chart) Viper Method
- This.YValue (Chart) Viper Method
- SXML Data Types
- Examples
- Tips & Tricks