The basic-sample-react-native project comes with the data routes setup in a JSON file. Can you tell me what the steps are for using a YAML file instead?

I swapped out the JSON file for a valid YAML file and changed the routeData path within dataService.disconnected.js. There must be another configuration step somewhere though, as that did not work for me.

  • Because of the experimental nature of react-native in JSS, the react-native sample is not up-to-date with the same patterns/practices as the other framework samples (React, Angular, Vue). I'll make note to look into updating the react-native sample as much as is realistic. Many of the disconnected mode features of the other samples are not possible for react-native. – Adam Weber Jul 25 '18 at 15:20

As YAML is a superset of JSON, any valid JSON is also valid YAML.

However, if you're looking for idiomatic YAML just run the JSON through a converter like https://www.json2yaml.com/

  • I think I'm trying to go the opposite direction of what you mentioned. I have JSON already, but I'd like to use YAML. Since YAML is not valid JSON, I don't think I can just swap out. Based on Adam's comment above, it sounds like the react-native sample just can't do YAML at the moment. Is that correct? – The Chad Jul 27 '18 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.