07-27-2022 12:43 PM
I just got a YAML file I have to parse. Before I "roll my own" Does anyone have a parser?
07-27-2022 05:26 PM
JSON may be a valid YAML parsing thingamjijjy.
07-27-2022 06:15 PM
Can you explain? YAML looks nothing like JSON. How might I use a JSON parser to read in a YAML doc?
07-27-2022 06:23 PM
@nanocyte wrote:
Can you explain? YAML looks nothing like JSON. How might I use a JSON parser to read in a YAML doc?
How do they look? Does it effect how you show them or what the data is?
We cannot tell unless you show a data file or attempt to use one in LabVIEW code you show. So, you want "Specific "answers? Geneneral information won't work.
07-27-2022 06:32 PM
Googling "LabVIEW YAML" resulted in this being the first link - https://www.vipm.io/package/nicolas_bats_lib_yaml_parser/
07-27-2022 07:02 PM
How do they look?
Using examples from wikipedia. YAML looks like this:
--- # Sequencer protocols for Laser eye surgery
- step: &id001 # defines anchor label &id001
instrument: Lasik 2000
pulseEnergy: 5.4
pulseDuration: 12
repetition: 1000
spotSize: 1mm
- step: &id002
instrument: Lasik 2000
pulseEnergy: 5.0
pulseDuration: 10
repetition: 500
spotSize: 2mm
- step: *id001 # refers to the first step (with anchor &id001)
- step: *id002 # refers to the second step
- step: *id002
And JSON looks like this
{
"firstName": "John",
"lastName": "Smith",
"isAlive": true,
"age": 27,
"address": {
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021-3100"
},
"phoneNumbers": [
{
"type": "home",
"number": "212 555-1234"
},
{
"type": "office",
"number": "646 555-4567"
}
],
"children": [
"Catherine",
"Thomas",
"Trevor"
],
"spouse": null
}
Note all the curly brackets in the JSON and the dashes in the YAML
Does it effect how you show them or what the data is?
I don't understand this question. I'm not trying to "show them" I'm just trying to get values from a string. For the example above, I might want to output an array of a cluster of "pulseEnergy" (a dbl) and "pulseDuration" (an int). I think this is what people commonly mean when they try to parse a file.