# Silent crash when adding key to nlohmann::json object with semicolon omitted

**URL:** <https://root-forum.cern.ch/t/silent-crash-when-adding-key-to-nlohmann-json-object-with-semicolon-omitted/64550>\
**Category:** ROOT\
**Tags:** bug, cling\
**Created:** [December 23, 2025, 11:50am UTC](https://root-forum.cern.ch/t/silent-crash-when-adding-key-to-nlohmann-json-object-with-semicolon-omitted/64550 "2025-12-23T11:50:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ako\_b](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/9f8e36/32.png) [@Ako\_b](https://root-forum.cern.ch/u/Ako_b)\
**Post date:** [December 23, 2025, 11:50am UTC](https://root-forum.cern.ch/t/silent-crash-when-adding-key-to-nlohmann-json-object-with-semicolon-omitted/64550/1 "2025-12-23T11:50:54Z")

</div>

### Describe the bug

ROOT interpreter crashes silently (even debug build) when a key with non-null value is added to a `nlohmann::json` object and semicolon at the end of line is omitted.

### Expected behavior

No crash, the contents of the json object displayed correctly.

### To Reproduce

```auto
$ root -l
root [0] #include "nlohmann/json.hpp"
root [1] nlohmann::json j
(nlohmann::json &) {}
root [2] j["nothing"] = nullptr
(nlohmann::basic_json<std::map, std::vector, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > &) {}
root [3] j["1"] = 1;
root [4] j["2"]
(nlohmann::basic_json<std::map, std::vector, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void>::value_type &) {}
root [5] j["3"] = 3
$ # silent crash

```

### Setup

```auto
ROOT v6.36.06
Built for linuxx8664gcc on Dec 06 2025, 07:41:55
From tags/6-36-06@6-36-06
With clang version 20.1.8 (AlmaLinux OS Foundation 20.1.8-1.el10.alma.1)
Binary directory: /opt/root-6.36.06-debug/bin

```

### Additional context

I reproduced the bug in ROOT v6.36.06 shipped via dnf, as well as in debug builds of v6.36.06 and v.6.38.00, both built with `-Dbuiltin_nlohmannjson=ON`.

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [December 25, 2025, 10:07am UTC](https://root-forum.cern.ch/t/silent-crash-when-adding-key-to-nlohmann-json-object-with-semicolon-omitted/64550/2 "2025-12-25T10:07:40Z")

</div>

Hello,

Thanks for the report.  
Over here it’s holidays… We’ll come back to this.

Cheers,  
D

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [January 8, 2026, 10:08am UTC](https://root-forum.cern.ch/t/silent-crash-when-adding-key-to-nlohmann-json-object-with-semicolon-omitted/64550/3 "2026-01-08T10:08:12Z")

</div>

Closed on January 8, 2026, 10:08am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [January 28, 2026, 1:27pm UTC](https://root-forum.cern.ch/t/silent-crash-when-adding-key-to-nlohmann-json-object-with-semicolon-omitted/64550/4 "2026-01-28T13:27:51Z")

</div>

Opened on January 28, 2026, 1:27pm UTC



---

<div class="post-metadata">

**Author:** ![Ako\_b](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/9f8e36/32.png) [@Ako\_b](https://root-forum.cern.ch/u/Ako_b)\
**Post date:** [May 21, 2026, 11:12am UTC](https://root-forum.cern.ch/t/silent-crash-when-adding-key-to-nlohmann-json-object-with-semicolon-omitted/64550/5 "2026-05-21T11:12:17Z")

</div>

Hi, @Danilo !

The issue is fixed by [ROOT interpreter crashes when using `nlohmann::json` · Issue #21058 · root-project/root · GitHub](https://github.com/root-project/root/issues/21058), so I think the topic can be safely closed.

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [May 21, 2026, 1:12pm UTC](https://root-forum.cern.ch/t/silent-crash-when-adding-key-to-nlohmann-json-object-with-semicolon-omitted/64550/6 "2026-05-21T13:12:09Z")

</div>

Indeed! Thanks for reaching out!

D
