Skip to content

Instantly share code, notes, and snippets.

@motyar
Last active March 18, 2018 04:34
Show Gist options
  • Save motyar/fc6937de0c8172fa36526da541409043 to your computer and use it in GitHub Desktop.
Save motyar/fc6937de0c8172fa36526da541409043 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Test js-yaml</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.11.0/js-yaml.min.js"></script>
<script type="text/javascript">
// YAML string to Javascript object
var obj = jsyaml.load( 'greeting: hello\nname: world' );
console.log( obj );
// YAML file to Javascript object
$.get( 'https://raw.githubusercontent.com/nodeca/js-yaml/c50f9936bd1e99d64a54d30400e377f4fda401c5/benchmark/samples/document_application2.yaml', function( data ) {
var obj = jsyaml.load( data );
console.log( obj );
});
// Huge YAML file (7.2 MB) to Javascript object
$.get( 'https://raw.githubusercontent.com/nodeca/js-yaml/master/benchmark/samples/document_huge.yaml', function( data ) {
var obj = jsyaml.load( data );
console.log( obj );
});
</script>
</head>
<body>
<h1>Test js-yaml</h1>
<p><a href="https://github.com/nodeca/js-yaml">https://github.com/nodeca/js-yaml</a></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment