normalizejsonnulls
Service icon

NormalizeJsonNulls

Stable version 1.0.0 (Compatible with OutSystems 11)
Uploaded
 on 10 Oct (4 hours ago)
 by 
0.0
 (0 ratings)
normalizejsonnulls

NormalizeJsonNulls

Details
Automatically normalizes `null` values ​​in JSON, converting them into default values ​​based on their data types. It supports nested objects, lists, and complex structures, preserving existing values ​​while ensuring greater consistency and security during data processing.
Read more

NormalizeJsonNulls

NormalizeJsonNulls is a reusable C# extension for OutSystems 11 that automatically normalizes null values in JSON responses based on the data types defined in a reference Structure.

The component uses C# Reflection to identify attribute types dynamically, replacing null values with their corresponding defaults while preserving existing data.

It supports primitive data types, nested objects, lists, and complex structures without requiring manual mapping of individual attributes.

Key Features

  • Automatic Type Detection: Uses the provided Structure to identify the expected data types.

  • Null Value Normalization: Converts null values into appropriate defaults for Text, Integer, Decimal, Boolean, and other supported types.

  • Nested Object Support: Recursively processes complex objects at multiple levels.

  • Automatic Object Expansion: Expands null objects and initializes their attributes with default values.

  • List Support: Converts null lists into empty arrays ([]).

  • Null List Item Handling: Normalizes null elements within lists according to their expected types.

  • Data Preservation: Keeps existing non-null values unchanged.

  • Reusable Integration: Works with different Structures through a single Server Action.

How It Works

The extension receives the original JSON and a reference Structure converted into an Object using ToObject().

It uses C# Reflection to inspect the Structure's data types and recursively normalize the corresponding JSON attributes.

For example, the following JSON:

{
  "name": null,
  "age": null,
  "active": null,
  "address": {
    "street": null,
    "number": null
  },
  "phones": null
}

Is normalized into:

{
  "name": "",
  "age": 0,
  "active": false,
  "address": {
    "street": "",
    "number": 0
  },
  "phones": []
}

The resulting JSON can then be used in REST integrations, deserialization workflows, or other data-processing operations.

Available Action

NormalizeJsonNulls

Input Parameters:

  • Json (Text): Original JSON content to be analyzed and normalized.

  • Structure (Object): Reference Structure used to identify the expected data types.

Output Parameter:

  • Result (Text): Normalized JSON containing the corresponding default values.

How to Use

  1. Add the NormalizeJsonNulls dependency to your application.

  2. Create a variable using the Structure that represents your JSON response.

  3. Call the NormalizeJsonNulls Server Action.

  4. Pass the original JSON to the Json parameter.

  5. Pass ToObject(MyStructure) to the Structure parameter.

  6. Use the returned Result as the normalized JSON.

Typical Use Cases

  • Handling null values in external REST API responses.

  • Preparing JSON payloads before deserialization.

  • Processing complex JSON responses containing nested objects and lists.

  • Standardizing JSON data for integration workflows.

  • Reducing repetitive null-handling logic across applications.

Compatibility

  • Platform: OutSystems 11

  • Technology: C# / .NET

  • Module Type: Extension

  • Execution: Server-side

  • Supported Applications: Reactive Web and other OutSystems 11 applications that can consume the extension.

Note: Normalization intentionally replaces JSON null values with defaults, which may change their original meaning. Ensure this behavior matches your integration requirements.

Demonstration

https://jah.outsystemscloud.com/NormalizeJsonNullsDemo


? If this component helps you, please leave a review on the OutSystems Forge! Your feedback is greatly appreciated.

Release notes (1.0.0)
License (1.0.0)
Reviews (0)
Team
Other assets in this category