Pretty Tables | Saneef H. Ansari | Observable
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
Comments (6)
Fabian Iwand
Sep 22, 2022
"Characters like ., will be removed from object keys" - why?
Sep 22, 2022
Link to translated version:
https://github-com.translate.goog/yetrun/json5-to-table?_x_tr_sl=zh-CN&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp
Saneef H. Ansari
Sep 22, 2022
The `json5-to-table` seems ignoring properties with `.` in the key. Here is a fork of this notebook with removal of `.` disabled,
https://observablehq.com/d/9de2579a129b779f#cell-16
.
Fabian Iwand
Sep 22, 2022
A split on "." seems to be the cause:
https://github.com/yetrun/json5-to-table/blob/e1b22a7979c77def70ae5f5b7bae480aaa09cfac/lib/helpers/retrieveProperty.js#L33
I can't immediately spot a straight forward way to work around that, but I'd recommend to replace "." with "_" instead of removing. Can you add an example to your fork that shows how commas in the prop name affect the output? In my tests adding a "," in the keys worked fine.
Saneef H. Ansari
Sep 22, 2022
Removing `,` is my stupidity. I'll keep commas as it is. I'll replace `.` to `_` like you suggested. Seems more sensible than removing it.
Sep 22, 2022
✅ Done
Reply
Add comment
Subscribe to notifications
Observable
Sign in
Saneef H. Ansari
16
Reply
Add comment
Subscribe to notifications
5
Pretty Tables | Saneef H. Ansari | Observable