Categories

For Own

Iterate over own object properties using lodash _.forOwn

Iterate over own enumerable properties of an object.

Highlights:

  • Uses lodash _.forOwn
  • Own enumerable properties only
  • Returns an ordered list of key/value entries

Example:

  • Object: {"a":1,"b":2}
  • Result: [{"key":"a","value":1},{"key":"b","value":2}]

Enter a JSON object

Key Facts

Category
Data Processing
Input Types
textarea
Output Type
text
Sample Coverage
4
API Ready
Yes

Overview

The For Own tool allows you to quickly iterate over the own enumerable properties of a JSON object using the lodash _.forOwn method, transforming complex data structures into a clean, ordered list of key-value pairs.

When to Use

  • When you need to extract and list all direct properties of a JSON object for easier inspection.
  • When you want to filter out inherited prototype properties and focus only on the object's own data.
  • When you need to convert a raw JSON object into a structured array format for further processing or display.

How It Works

  • Paste your JSON object into the input area.
  • The tool applies the lodash _.forOwn function to the input.
  • It isolates the object's own enumerable properties.
  • The output is generated as an ordered list of key and value entries.

Use Cases

Converting configuration objects into lists for UI rendering.
Debugging object states by flattening them into readable key-value pairs.
Preparing object data for mapping or transformation tasks in data pipelines.

Examples

1. Flattening Configuration Settings

Frontend Developer
Background
A developer has a complex configuration object containing various UI theme settings.
Problem
Need to display these settings in a table format within an admin dashboard.
How to Use
Paste the theme configuration object into the input field to generate a list of settings.
Example Config
{"primaryColor": "#007bff", "fontSize": "14px", "borderRadius": "4px"}
Outcome
A clean array of objects: [{"key":"primaryColor","value":"#007bff"}, {"key":"fontSize","value":"14px"}, {"key":"borderRadius","value":"4px"}]

2. Extracting API Response Data

Data Analyst
Background
An API response returns a user profile object with multiple metadata fields.
Problem
Need to isolate specific user attributes for a report without manually parsing the JSON.
How to Use
Input the user profile JSON to quickly extract all key-value pairs.
Example Config
{"id": 101, "username": "jdoe", "active": true}
Outcome
An ordered list of user attributes ready for documentation or further analysis.

Try with Samples

json

Related Hubs

FAQ

What does 'own enumerable properties' mean?

It means the tool only includes properties defined directly on the object itself, excluding any properties inherited through the prototype chain.

Does this tool support nested objects?

The tool processes the top-level object provided. If a value within the object is another object, it will be returned as that value.

Is the output order guaranteed?

Yes, the tool returns an ordered list of key-value entries based on the iteration of the object's own properties.

What happens if the input is not a valid JSON object?

The tool requires a valid JSON object to function correctly; invalid syntax will prevent the iteration process.

Can I use this for large JSON files?

This tool is designed for standard JSON objects; for extremely large datasets, ensure your input remains within the character limits of the text area.

API Documentation

Request Endpoint

POST /en/api/tools/for-own

Request Parameters

Parameter Name Type Required Description
objectInput textarea Yes Enter a JSON object

Response Format

{
  "result": "Processed text content",
  "error": "Error message (optional)",
  "message": "Notification message (optional)",
  "metadata": {
    "key": "value"
  }
}
Text: Text

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-for-own": {
      "name": "for-own",
      "description": "Iterate over own object properties using lodash _.forOwn",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=for-own",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]