How to parse using boost if it is not json, but si

2019-08-15 05:15发布

I have an application that reads some parameters from a json file, but now the file has changed (it is not my decision). The file looks pretty the same, but instead of {} it has [], so if until now it looked like

{
  "A":
  {
    "a":"a",
    "b":"b"
  }
}

now it is like this:

[
  "A":
  [
    "a":"a",
    "b":"b"
  ]
]

My application is written in C++, so I have used boost to parse the json file, but now I am looking for a new parser, is there a way to do it with boost?

I have started to search, but I have also asked the question thinking that maybe someone may help me faster than me finding the answer. Thanks

1条回答
虎瘦雄心在
2楼-- · 2019-08-15 05:50

It looks like Yet Another YAML/Mustache/JSON/... derivative.

Without a formal spec it's hard to actually assess what effort would be required, but here's a list of implementations of similar grammars in Boost Spirit, with varying amounts of feature completeness:

Applications of a toy JSON parser implementation:

查看更多
登录 后发表回答