Documentation for JSON to Excel Converter Component
Overview
This component provides the ability to convert JSON data into Excel files within OutSystems using a custom C# action. The component utilizes the EPPlus library to create Excel files and Newtonsoft.Json for JSON deserialization. It supports both single JSON objects and arrays of objects, converting them into Excel format.
Features
- Convert JSON arrays or single objects into Excel files.
- Compatible with various JSON structures.
- Easy integration into OutSystems logic.
- Provides a downloadable Excel file as output.
How to Use the Component
1. **Install the Component**:
- Download and install the component from OutSystems Forge into your application.
2. **Configure the JSON Input**:
- Prepare your JSON data, ensuring it is in the correct format (array of objects or a single object).
- Example of a JSON Array:
```json
[
{ "Name": "John Doe", "Age": 30, "Email": "john@example.com" },
{ "Name": "Jane Smith", "Age": 25, "Email": "jane@example.com" }
]
```
- Example of a Single JSON Object:
{
"Name": "Alice Brown",
"Age": 28,
"Email": "alice@example.com"
}
3. **Call the Action**:
- In your OutSystems logic, use the provided action (`ConvertJsonToExcel`).
- Pass the JSON string as input to the action.
4. **Receive Excel Output**:
- The action returns a byte array, which represents the generated Excel file.
- Use OutSystems logic to create a download link or store the file.
Input and Output
- **Input**: A JSON string representing either a single object or an array of objects.
- **Output**: A byte array containing the Excel file, which can be downloaded or stored.
Error Handling
- If the JSON format is incorrect (e.g., an invalid structure), the action will throw an error. Ensure that the input JSON is valid.
Example Use Case
1. You have JSON data returned from an API and want to export it as an Excel report.
2. Pass the JSON data to the component's action.
3. The action converts the data to Excel, and you can offer it as a downloadable file for the end-user.
Dependencies
- **EPPlus**: Used for generating Excel files.
- **Newtonsoft.Json**: Used for deserializing the JSON data into a structure compatible with Excel.
Limitations
- This component assumes the JSON is well-formed and represents a table-like structure.
- Large datasets may take longer to process due to the nature of Excel file creation.
Support
For any issues or questions, you can contact me anytime