1) a parser which can handle both (based on detecting both and then switches the parsing depending on it)
2) a parser which is made for YAML and happens to be able to parse JSON