boostorg / boostorg/json

Support python-style '#' comments

オープン
#839 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C++
スター
479
フォーク
110
平均マージ
10日 3時間
マージ済み PR(30日)
5

説明

PLEASE DON'T FORGET TO "STAR" THIS REPOSITORY :)

When reporting a bug please include the following:

### Version of Boost

1.81

### Steps necessary to reproduce the problem

```
auto parse = [](json::string_view s)
{
return json::parse(
s,
json::storage_ptr(),
json::parse_options { .allow_comments = true,
.allow_trailing_commas = true });
};

parse(R"_json_(
{
"exchange": "bitmex",
"from": "2019-10-01",
"to": "2019-10-02",
"symbols": ["XBTUSD", "ETHUSD"],
"withDisconnectMessages": true,
"dataTypes": ["trade", "book_change", "book_snapshot_10_100ms"],
# other available data types examples:
# 'book_snapshot_10_100ms', 'derivative_ticker', 'quote',
# 'trade_bar_10ms', 'trade_bar_10s'
}
)_json_")
```

This JSON will be parsed by python's parser, but not by boost.json

### All relevant compiler information

Any

### Arguments for supporting this

I am writing a back testing and systematic trading engine. The engine is configured with JSON, picked up either off a config file or via a data bus such as RabbitMQ.

Some components of the system are written in C++ and some in Python. It would be useful to be able to add comments to config files that were parsed by both kinds of components.

### Workaround:

```
parse(R"_json_(
{
"exchange": "bitmex",
"from": "2019-10-01",
"to": "2019-10-02",
"symbols": ["XBTUSD", "ETHUSD"],
"withDisconnectMessages": true,
"dataTypes": ["trade", "book_change", "book_snapshot_10_100ms"],
"_1": "other available data types examples:",
"_2": 'book_snapshot_10_100ms', 'derivative_ticker', 'quote','trade_bar_10ms', 'trade_bar_10s'"
}
)_json_")
```

But you know, yuk!

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。