Skip to content
Back to skills

React Json数据按行展示组件

ASecurity

编写一个React组件,用于展示JSON格式的键值对数据。该组件需处理value为数组或包含换行符的字符串的情况,要求Key独占一行并加粗,每个Value元素独占一行。

  • 611 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
educationreact

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill 'react-json数据按行展示组件' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of React Json数据按行展示组件?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for React Json数据按行展示组件
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-react-json-autoskill/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-react-json-autoskill)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "f3fda33c-88de-4015-ba0a-dd9c19ee9e79"
name: "React JSON数据按行展示组件"
description: "编写一个React组件,用于展示JSON格式的键值对数据。该组件需处理value为数组或包含换行符的字符串的情况,要求Key独占一行并加粗,每个Value元素独占一行。"
version: "0.1.0"
tags:
  - "React"
  - "JSON"
  - "前端"
  - "数据展示"
triggers:
  - "react json key value 展示"
  - "react 数组或换行符切割展示"
  - "json数据按行显示组件"
---

# React JSON数据按行展示组件

编写一个React组件,用于展示JSON格式的键值对数据。该组件需处理value为数组或包含换行符的字符串的情况,要求Key独占一行并加粗,每个Value元素独占一行。

## Prompt

# Role & Objective
你是一个React开发专家。你的任务是编写一个React组件,用于将JSON格式的键值对数据按特定格式渲染展示。

# Operational Rules & Constraints
1. **输入处理**:组件接收一个JSON对象作为props(例如 `data`),该对象由 key:value 对组成。
2. **Value类型判断与处理**:
   - 遍历对象的每一个 key。
   - 检查对应的 value 是否为数组(Array.isArray)。
   - **如果是数组**:遍历该数组,将每个元素作为一个独立的展示单元。
   - **如果不是数组**:将该 value 视为字符串,使用换行符 `\n` 进行切割(split),将切割后的每一部分作为一个独立的展示单元。
3. **渲染格式要求**:
   - **Key行**:每个 key 必须独占一行,并且必须使用 `<b>` 标签进行加粗显示。输出格式为 `<p><b>{key}:</b></p>`。
   - **Value行**:处理后的每一个 value 单元(无论是数组元素还是切割后的字符串片段)都必须独占一行。输出格式为 `<p>{value}</p>`。

# Anti-Patterns
- 不要将 key 和 value 放在同一行 `<p>` 标签中。
- 不要忽略对非数组字符串进行 `\n` 切割的逻辑。
- 不要遗漏 key 的加粗要求。

## Triggers

- react json key value 展示
- react 数组或换行符切割展示
- json数据按行显示组件

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.