Class JsonLayoutOptions

JsonLayoutOptions class

Represents the options of json layout type.

public class JsonLayoutOptions

Constructors

NameDescription
JsonLayoutOptions()Constructor of loading JSON layout options.

Properties

NameDescription
ArrayAsTable { get; set; }Processes Array as table.
ConvertNumericOrDate { get; set; }Indicates whether converting the string in json to numeric or date value.
DateFormat { get; set; }Gets and sets the format of date value.
IgnoreArrayTitle { get; set; }(Obsolete.) Indicates whether ignore title if array is a property of object.
IgnoreNull { get; set; }Indicates whether ignoring null value.
IgnoreObjectTitle { get; set; }(Obsolete.) Indicates whether ignore title if object is a property of object.
IgnoreTitle { get; set; }Ingores titles of attributes
KeptSchema { get; set; }Indicates whether keeping schema of this json.
NumberFormat { get; set; }Gets and sets the format of numeric value.
TitleStyle { get; set; }Gets and sets the style of the title.

Examples

using System;
using System.IO;
using Aspose.Cells;
using Aspose.Cells.Utility;

namespace AsposeCellsExamples
{
    public class UtilityClassJsonLayoutOptionsDemo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Create JsonLayoutOptions and set properties
            JsonLayoutOptions options = new JsonLayoutOptions
            {
                ArrayAsTable = true,
                ConvertNumericOrDate = true,
                IgnoreArrayTitle = false,
                IgnoreObjectTitle = false
            };

            // Sample JSON data
            string jsonData = @"{
                ""Name"": ""John"",
                ""Age"": 30,
                ""Departments"": [""HR"", ""Finance"", ""IT""]
            }";

            // Import JSON data to worksheet
            JsonUtility.ImportData(jsonData, worksheet.Cells, 0, 0, options);

            // Save the workbook
            workbook.Save("JsonLayoutOptionsDemo.xlsx");
        }
    }
}

See Also