Categories

For In Object

Iterate over object properties using lodash _.forIn

Iterate over own and inherited enumerable properties of an object.

Highlights:

  • Uses lodash _.forIn
  • Includes inherited enumerable properties
  • 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 In Object tool allows you to quickly iterate over the properties of a JSON object using the lodash _.forIn method, providing a clean, ordered list of key-value pairs.

When to Use

  • When you need to extract and list all enumerable properties from a complex JSON object.
  • When you want to include both own and inherited properties in your data processing workflow.
  • When you need to transform a nested object into a flat, readable array of entries for further analysis.

How It Works

  • Paste your JSON object into the input area.
  • The tool applies the lodash _.forIn function to traverse the object's properties.
  • It automatically captures both own and inherited enumerable properties.
  • The output is generated as an ordered list of key-value objects.

Use Cases

Converting configuration objects into arrays for UI rendering.
Debugging object structures by listing all available keys and their associated values.
Preparing data for iteration-based logic in downstream applications.

Examples

1. Extracting Configuration Keys

Frontend Developer
Background
A developer has a configuration object containing various UI settings and needs to map them into a list for a settings dashboard.
Problem
The object is complex and needs to be converted into an array of key-value pairs to be rendered in a table.
How to Use
Input the configuration object into the tool to generate the list.
Example Config
{"theme": "dark", "fontSize": 14, "showSidebar": true}
Outcome
[{"key":"theme","value":"dark"},{"key":"fontSize","value":14},{"key":"showSidebar","value":true}]

2. Flattening Data for API Payload

Backend Engineer
Background
An engineer needs to transform a user profile object into a flat array to meet specific API requirements.
Problem
The API expects an array of entries rather than a single object.
How to Use
Paste the user profile object into the tool to get the formatted array.
Example Config
{"id": 101, "username": "jdoe", "active": true}
Outcome
[{"key":"id","value":101},{"key":"username","value":"jdoe"},{"key":"active","value":true}]

Try with Samples

json

Related Hubs

FAQ

What does the For In Object tool do?

It iterates over all enumerable properties of a provided JSON object, including inherited ones, and returns them as an ordered list.

Does it include inherited properties?

Yes, the tool uses lodash _.forIn, which iterates over both own and inherited enumerable properties.

What is the output format?

The output is returned as an array of objects, where each object contains a 'key' and a 'value' field.

Is this tool limited to own properties only?

No, unlike some native methods, this tool specifically includes inherited enumerable properties.

Can I process large JSON objects?

Yes, the tool efficiently handles JSON objects by converting them into a structured list format.

API Documentation

Request Endpoint

POST /en/api/tools/for-in-object

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-in-object": {
      "name": "for-in-object",
      "description": "Iterate over object properties using lodash _.forIn",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=for-in-object",
      "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]