While working on PuppyAgent, I needed to turn nested JSON into records for an embedding index. Before I could write the conversion, we had to agree on what those records should contain. The turning point in the discussion was identifying the operation as flattening the internal structure, then deciding which relationships to preserve as metadata.
Later, I also worked on a recursive table for displaying nested JSON. When I saw RAGFlow's interface, parts of it reminded me of that work. Looking at its code helped me separate the visual resemblance from the underlying requirements: similar interfaces and related JSON-processing features can serve different purposes.
Dates: The creation timestamp above follows the first relevant Cursor reply on January 3, 2025. The historical last-modified timestamp follows the final JSX reply in my January 23 recursive-table discussion. These mark the development period covered by this note, not the dates this retrospective article was physically written. I assembled and checked it on November 16, 2026, including the later RAGFlow comparison. All times below use UTC+8. My prompts lack individual timestamps, so approximate conversation times come from the adjacent assistant replies. The embedding session itself was created on January 2.12
Making the requirement concrete
My recollection of the development meeting is that the CEO and another engineer, who had joined before me, were describing the metadata-extraction feature differently. We had not yet arrived at a clear description of the transformation. I asked whether what they wanted was to flatten the internal structure. With that operation named, we gradually clarified the requirement together, including what metadata each output item needed. Once that was clear, I made a demo.
We had spent rather more time discussing the transformation than it took to demonstrate it. Once we agreed on the input, output, and metadata, a short exchange with Cursor was enough to produce something we could inspect. The recursive function, it turned out, had been waiting for a specification.
That meeting account is my later recollection, rather than a transcript. What stayed with me was how much of the engineering work lay in making the requirement precise and reviewing the generated code. “Extract metadata” had been too vague; a concrete input and output gave us something useful to disagree about.
My first conversation with Cursor
On January 3, I had this conversation with Cursor in a session called TypeScript Function for JSON to Embedding View. My original prompt was:
help me write a typescript function that takes the originl views' json and translate them then return the format of enbedding views
— My prompt, original message 1; following reply around 13:42.1
Cursor initially enumerated several shapes: arrays of primitives, individual objects, arrays of objects, and increasingly nested combinations. Its implementation included hardcoded fields such as description and descriptions. That approach did not express the general rule I needed.
I clarified it:
wrong it has to be a logic that traverses the json in order to every leaf that is string, and put all the string leaves one by one, and give every leaf an ascending id and a path(which is translate to e.g. key_0 list_1 key_2 list_2 for a string in object->list->object->list->the string)
— My correction, original message 3; following reply around 13:58.1
Cursor then produced traverseJson. The function handled three cases: emit a record for a string, recurse over an array's elements, or recurse over an object's properties. The same rule handled different nesting depths without enumerating every possible shape.
The crucial part of my prompt was the output contract: every string leaf becomes an item, each item receives a sequential ID, and its location survives as metadata. Recursion implemented that contract.
What flattening meant here
For an input like this:
{
"name": "John",
"details": {
"hobbies": ["reading", "gaming"]
}
}
the original demo produces:
[
{
"content": "John",
"metadata": { "id": "0", "key_0": "name" }
},
{
"content": "reading",
"metadata": {
"id": "1",
"key_0": "details",
"key_1": "hobbies",
"list_2": 0
}
},
{
"content": "gaming",
"metadata": {
"id": "2",
"key_0": "details",
"key_1": "hobbies",
"list_2": 1
}
}
]
This is a shortened example using values from the original demo. The numeric suffix records the depth in the path. key_1 means an object-key step at depth 1; list_2 means an array-index step at depth 2. The prefixes preserve the distinction between an object property and an array element.1
The function prepares records; it does not calculate embedding vectors. It also only emits strings. Numbers, booleans, and null values do not become separate content records in this version. Flattening here therefore means extracting string leaves while retaining their structural locations, rather than providing a lossless encoding of the entire JSON document.
This is the core function from the original Cursor reply, with comments omitted and formatting normalized. EmbeddingItem is the content-and-metadata record illustrated above.1
function traverseJson(
data: any,
result: EmbeddingItem[] = [],
path: string[] = [],
idCounter: { value: number } = { value: 0 }
): EmbeddingItem[] {
if (typeof data === 'string') {
const metadata: Record<string, any> = {
id: String(idCounter.value++)
};
path.forEach((step, index) => {
if (step.startsWith('key_')) {
metadata[`key_${index}`] = step.substring(4);
} else if (step.startsWith('list_')) {
metadata[`list_${index}`] = parseInt(step.substring(5));
}
});
result.push({
content: data,
metadata: metadata
});
} else if (Array.isArray(data)) {
data.forEach((item, index) => {
traverseJson(item, result, [...path, `list_${index}`], idCounter);
});
} else if (data && typeof data === 'object') {
Object.entries(data).forEach(([key, value]) => {
traverseJson(value, result, [...path, `key_${key}`], idCounter);
});
}
return result;
}
Each recursive call receives its own extended path, while all calls share the result array and ID counter. The string branch is the only place that emits a record, which makes the output boundary explicit.
From the demo to metadata construction
By my January 20 commit, JsonNode.tsx contained the traversal together with the surrounding embedding-index preparation code. The implementation also added metadata.path as an array of object keys and numeric indices.34
The next stage, constructMetadataInfo, used that path to derive additional context from the original input. It called removeItemFromData and attached the returned structure as metadata.info. This added another requirement beyond finding the leaf: deciding what context should remain after removing the selected content.
The assignment inside that helper was short; its meaning depended on the removal rule we agreed on. This excerpt preserves the statements from the committed code, with indentation normalized:4
const path = item.metadata.path
const result = removeItemFromData(data, path)
item.metadata.info = result
Earlier that evening, I had asked Cursor:
if last key is array index then remove the entire array from object
— My prompt in Remove Array from Object by Index, original message 1.5
When its suggested code addressed the wrong object, I corrected it:
current is not paren object so using parentkey on it is wrong
— My correction, original message 3.5
This explains why the metadata discussion mattered. Extracting "reading" was straightforward. Defining whether its context should retain or remove the containing hobbies array was a separate product rule.
At 19:16:06 on January 20, I committed “fix the embedding data construction logic.” The patch changed the removal logic and refreshed the constructed embedding-view data in the action handler. It was a later refinement, not the first introduction of traverseJson.3
I would not treat the AI replies or this commit as proof that every edge case was correct. For example, the committed removal helper inferred an array index from whether the final path segment looked numeric. A numeric-looking object key can make that distinction ambiguous. The code also cloned the source data for each item's contextual metadata, which could become expensive for larger inputs. These are details I would revisit beyond the demo.4
A separate recursive JSON table
On January 23, I worked through a related display problem with Cursor in JSON Form Positioning Issue. After discussing positioning, I asked:
help me add a nested table here with random example data
Then I made the nesting more specific:
how about another example with table inside td
— My prompts, original messages 5 and 7; following replies around 17:26 and 17:29.2
I next asked for a recursive function to generate that structure from a JavaScript object. Cursor again produced a solution tied to the example's fields. I corrected it:
no i want it to be recursive and can handle any object
Finally, I asked:
can you make it a function produce jsx to use in react
— My prompts, original messages 11 and 13; following replies around 17:41 and 17:43.2
This was recursive rendering: an object or array led to another nested table, while a primitive value became display content. The earlier embedding conversion had traversed the structure to produce a flat list. Both used recursion, but they produced different outputs.
The conversation records the prototype discussion, not a complete editor or proof that I accepted the proposed code unchanged. The final JSX suggestion even returned a <td> for a primitive from inside an existing <td>, which would require correction. Asking for the right general rule did not remove the need to review the generated implementation.2
I also found a later image preserved in the PuppyOne repository that shows the structured-node presentation. In this crop, description contains two indexed values displayed inside the surrounding object's table.

Figure 1. Cropped from the repository's “get started screen” template image, added on September 22, 2025. This is a later retained view of the interface, not a screenshot of my January demo. The crop is saved locally as a compressed JPEG.6
Similar UI, related features, different problems
Much later, I saved screenshots of RAGFlow's demo because the interface reminded me of the data presentation I had worked on. The screenshot filenames are dated December 23, 2025; they do not establish when either implementation was created.

Figure 2. My RAGFlow demo screenshot, cropped to the chunk list and source-document view. The table inside a content card was part of what reminded me of PuppyAgent's structured display.7

Figure 3. Another frame from my screenshots, showing the enlarged source-table preview. The popup helps inspect the source material; its appearance alone does not identify how JSON is traversed. Both RAGFlow images are cropped JPEGs of my supplied screenshots.7
When I checked the code, I found three things worth separating.
First, the chunk-card component corresponding to that style of interface renders HTML from content_with_weight, alongside image previews and controls. The inspected component does not recursively turn arbitrary JSON into nested tables. A table visible inside a chunk is therefore not, by itself, evidence of the same JSON-table implementation.8
The relevant JSX property makes that distinction visible. Here the component sanitizes and renders an existing HTML string; it does not build table cells by walking JSON keys:8
dangerouslySetInnerHTML={{
__html: DOMPurify.sanitize(item.content_with_weight),
}}
Second, RAGFlow does have a related recursive JSON-processing feature. A June 21, 2024 commit added a JSON parser whose source explicitly credits adaptation from LangChain's JSON text splitter. It recursively handles nested structures, tracks paths, and reconstructs those paths inside output chunks.9
Third, RAGFlow introduced a wrapper around the third-party jsoneditor package on November 20, 2025, offering tree and code modes. That dates this particular integration; it does not establish the first JSON-editing feature anywhere in RAGFlow, or the origin of recursive JSON editors generally.10
The parser is the closest comparison to my embedding preparation, but its output contract differs:
| Question | My traverseJson demo | RAGFlow's historical JSON splitter |
|---|---|---|
| What determines an output item? | Each string leaf. | The size of the JSON content being grouped or split. |
| Where does structural context go? | Separate path metadata; later code adds contextual info. | Nested structure reconstructed inside each JSON chunk. |
| Can several fields stay together? | Each string leaf becomes its own record. | Yes, if they fit within the size budget. |
| What happens to arrays? | Array indices are distinguished from object keys. | With list conversion enabled, arrays become objects with numeric string keys. |
| What problem does it address? | Preparing explicit content-and-metadata records for indexing. | Dividing a JSON document into manageable pieces while retaining structure. |
Here, “chunk size” means the amount of content in one piece. In the historical RAGFlow implementation I inspected, the size estimate is the character length of serialized JSON, rather than a direct token count. Small structures can remain together; larger structures cause further splitting. An oversized indivisible value can still exceed the target, so this is not a strict guarantee that every result fits a model's input limit.9
For example, my function always emits a person's name, biography, and city as three records when all three are strings. The RAGFlow splitter can keep the whole object together if it fits. My function also leaves a very long biography as one record, because its boundary is the string leaf rather than its length.
That makes a blanket comparison of which implementation is more elegant unhelpful. My three-case traversal is direct for the requirement we agreed on. RAGFlow carries additional logic for sizing, grouping, and rebuilding structure because it has a different job. The two operations could even be combined: I could extract leaf records first, then split oversized content while carrying its metadata into each resulting piece.
The historical evidence supports a limited conclusion: RAGFlow had recursive JSON splitting before my January 2025 work. The code inspected does not establish that it used my particular leaf-to-metadata contract or recursive-table design. The screenshots do not establish either direction of copying.
The development sequence I can date
| Date, UTC+8 | What I can trace |
|---|---|
| January 3, 2025, approximately 13:42–13:58 | I asked for the embedding-view conversion, rejected hardcoded cases, and specified string leaves, sequential IDs, and paths. |
| January 20, approximately 18:30–18:36 | I clarified the parent-array removal rule for contextual metadata. |
| January 20, 19:16:06 | I committed the embedding-data construction refinement, 4b79487. |
| January 23, approximately 17:26–17:43 | I developed the nested-table idea through examples, a recursive object renderer, and a request for React JSX. |
I cannot assign an exact date to the development meeting from these records. What I can follow is how I specified the transformation in Cursor, refined the contextual metadata, and separately explored a recursive display.
The part I want to carry into future work is making the transformation concrete early. Naming flattening gave us a starting point, but we still had to agree on the unit of content and the meaning of metadata. Once those decisions were explicit, I could build a demo that everyone could inspect and correct.
References
Footnotes
-
CaiBorui & Cursor. (2025, January 3). TypeScript Function for JSON to Embedding View [Cursor conversation excerpt, messages 1–4]. Session
95b83044-6e55-4361-9da7-8c2b7d47a60f. Archived original messages. Times follow assistanttimingInfo.clientStartTime; the session was created January 2. Verified November 16, 2026. ↩ ↩2 ↩3 ↩4 ↩5 -
CaiBorui & Cursor. (2025, January 23). JSON Form Positioning Issue [Cursor conversation excerpt, messages 5–14]. Session
d887159c-2f3e-4956-af50-8c0ec6ad37f2. Archived original messages. Times follow assistanttimingInfo.clientStartTime. Verified November 16, 2026. ↩ ↩2 ↩3 ↩4 -
caiborui [S2thend]. (2025, January 20). Fix the embedding data construction logic [Commit 4b79487]. GitHub, puppyone-ai/puppyone-cloud. https://github.com/puppyone-ai/puppyone-cloud/commit/4b794874979187b2397e40073abfea3d52a8bb7a ↩ ↩2
-
PuppyAgent contributors. (2025, January 20). JsonNode.tsx [Source code at commit 4b79487]. GitHub, puppyone-ai/puppyone-cloud.
traverseJson,removeItemFromData,constructMetadataInfo, andonEmbeddingClick. https://github.com/puppyone-ai/puppyone-cloud/blob/4b794874979187b2397e40073abfea3d52a8bb7a/PuppyFlow/app/components/workflow/nodes/JsonNode.tsx#L377 ↩ ↩2 ↩3 -
CaiBorui & Cursor. (2025, January 20). Remove Array from Object by Index [Cursor conversation excerpt]. Session
1a9d126d-7b77-49a6-a167-3350d7ac56b0; quotations from messages 1 and 3. Archived original messages and selected code. Verified November 16, 2026. ↩ ↩2 -
PuppyAgent contributors. (2025, September 22). Get started screen [Workflow template screenshot]. GitHub, puppyone-ai/puppyone-cloud. Added in commit
08604ce(“new templates”); the original image includes the structured text node cropped in Figure 1. Original repository image. Later preserved underarchived/PuppyFlow/public/templetepicture/. Retrieved November 16, 2026. ↩ -
CaiBorui. (2025, December 23, per filenames). RAGFlow chunk and table-preview demo [Personal screenshots of InfiniFlow's RAGFlow GitHub README demo]. Sources:
截屏2025-12-23 14.09.39.pngand截屏2025-12-23 14.09.12.png. Demo animation shown in the README. Figures 2–3 are cropped from these screenshots, rather than downloaded frames of the current animation. Crop coordinates, source hashes, and JPEG settings. ↩ ↩2 -
InfiniFlow contributors. (2025, January 2). ChunkCard [Source snapshot at commit 8674156]. GitHub, infiniflow/ragflow. HTML rendering of
content_with_weightinchunk-card/index.tsx. https://github.com/infiniflow/ragflow/blob/8674156d1c704fea1369964cc874b01d3a102160/web/src/pages/add-knowledge/components/knowledge-chunk/components/chunk-card/index.tsx ↩ ↩2 -
InfiniFlow contributors. (2024, June 21). feat: support json file (#1217) [Commit 18f4a6b]. GitHub, infiniflow/ragflow. Added
deepdoc/parser/json_parser.py; see_json_size,_list_to_dict_preprocessing,_json_split, and the LangChain attribution at the top of the file. https://github.com/infiniflow/ragflow/commit/18f4a6b35cc8a9bb143b17042ec37818e3df88ec ↩ ↩2 -
InfiniFlow contributors. (2025, November 20). Fix: Introducing a new JSON editor (#11401) [Commit ea0352e]. GitHub, infiniflow/ragflow. Addition of
jsoneditorto dependencies andweb/src/components/json-edit/index.tsx. https://github.com/infiniflow/ragflow/commit/ea0352ee4afc3c870d9fc913b5f76713a2c2994b ↩