Gets the number of properties on the outer JSON object.
This viper method also supports the extension viper syntax.
Syntax
Smartsite SXML | Copy Code |
---|---|
integer this.length() integer this.length(string name) |
Extension Viper Syntax
Smartsite SXML | Copy Code |
---|---|
integer page.<id>.length() integer page.<id>.length(string name) |
Parameters
Name | Data Type | Description |
---|---|---|
name | String | The name property. |
Return Value
Data Type | Description |
---|---|
Integer | The number of properties on the outer JSON object. |
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. |
Example
Enumerate Json Properties Example
This example shows how to use the Json vipers GetByPosition and GetValueByPosition. Note the use of default in GetValueByPosition, because Object properties (nested Json values) do not translate to a native Sxml type.
GetByPosition returns a Json string that can be used to populate a new Json macro directly.
The last for loop demonstrates the two ways of getting a value by position: through the name, using GetNameByPosition, or directly from the Json, using GetValueByPosition
Smartsite SXML | Copy Code |
---|---|
<se:json> { "first": "1st", "second": "IInd", "third": [{"test":"a"},{"test":"b"},{"test":"d"},{"test":"c"}], "fourth": {"first":1,"second":2,"third":3} } </se:json> <se:for from="1" to="{scope.json.length()}"> {scope.json.getvaluebyposition(this.index()-1,default="{Json}")} </se:for> == <se:for from="1" to="{scope.json.length(third)}"> <se:json localid="nested"> {scope.json.getbyposition("third",this.parent.index()-1)} </se:json> {this.index()}: {scope.nested.get(test)} </se:for> == <se:for from="0" to="{sys.eval(scope.json.length(fourth)-1)}"> {buffer.set(propname,scope.json.getnamebyposition(fourth,this.index()))} {this.index()}; {buffer.get(propname)}; {scope.json.getvalue("fourth." + $propname)}; {scope.json.getvaluebyposition(fourth, this.index())} </se:for> |
- 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 (Json) 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 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