alibaba / alibaba/fastjson2

[BUG] JSONWriter.writeNameValue is broken

Open
#3,224 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

### 问题描述

The implementation of `JSONWriter.writeNameValue` is broken. It is missing a call to `writeColon` between the `writeName` and `writeAny`.

### 环境信息

- OS信息: macOS Sequoia
- JDK信息: OpenJDK 21
- 版本信息:Fastjson2 2.0.53

### 重现步骤

1. Call `writeNameValue("foo", "bar")` on a `JSONWriter`
2. Observe that the written JSON is missing a colon
```
"foo""bar"
```

### 期待的正确结果

```
"foo": "bar"
```

### 相关日志输出

N/A

#### 附加信息

N/A

Contributor guide

Open the contributing guide

Research direction

Start by locating JSONWriter.writeNameValue and inspect the sequence around writeName and writeAny. Reproduce the issue with writeNameValue("foo", "bar") and verify that the output includes a colon between the name and value.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.