|
|
@ -6,79 +6,138 @@ |
|
|
|
<title>JsonPath</title> |
|
|
|
<title>JsonPath</title> |
|
|
|
<link rel="stylesheet" href="/static/css/bootstrap.css"> |
|
|
|
<link rel="stylesheet" href="/static/css/bootstrap.css"> |
|
|
|
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"> |
|
|
|
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"> |
|
|
|
|
|
|
|
<link rel="stylesheet" href="//google-code-prettify.googlecode.com/svn/loader/prettify.css"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="//google-code-prettify.googlecode.com/svn/loader/prettify.js?autoload=false"></script> |
|
|
|
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> |
|
|
|
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> |
|
|
|
|
|
|
|
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> |
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="/static/js/jsonpath-0.8.0.js"></script> |
|
|
|
<script type="text/javascript" src="/static/js/jsonpath-0.8.0.js"></script> |
|
|
|
<script type="text/javascript" src="/static/js/bootstrap.js"></script> |
|
|
|
<script type="text/javascript" src="/static/js/bootstrap.js"></script> |
|
|
|
<script src="//google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script> |
|
|
|
|
|
|
|
</head> |
|
|
|
</head> |
|
|
|
<body role="document"> |
|
|
|
<body role="document"> |
|
|
|
<div class="container"> |
|
|
|
<div class="container"> |
|
|
|
<div class="jumbotron"> |
|
|
|
|
|
|
|
<h3>JSONPath evaluator</h3> |
|
|
|
<h3>JSONPath evaluator</h3> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="row"> |
|
|
|
<div class="row"> |
|
|
|
<div class="col-md-6"> |
|
|
|
<div class="col-md-6"> |
|
|
|
<form method="post"> |
|
|
|
<form id="form"> |
|
|
|
<div class="form-group"> |
|
|
|
<div class="form-group"> |
|
|
|
<select id="templates" name="template" class="form-control" onChange='window.location="?template=" + this.value;'> |
|
|
|
<select id="selTemplates" name="template" class="form-control"> |
|
|
|
{{#templates}} |
|
|
|
<option value="blank"></option> |
|
|
|
<option value="{{value}}" {{selected}}>{{name}}</option> |
|
|
|
<option value="goessner">goessner</option> |
|
|
|
{{/templates}} |
|
|
|
<option value="twitter">twitter</option> |
|
|
|
|
|
|
|
<option value="webapp">webapp</option> |
|
|
|
|
|
|
|
<option value="20k">20k</option> |
|
|
|
</select> |
|
|
|
</select> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="form-group"> |
|
|
|
<div class="form-group"> |
|
|
|
<textarea id="json" name="json" rows="20" class="form-control">{{json}}</textarea> |
|
|
|
<textarea id="txtJson" name="json" rows="15" class="form-control" placeholder="Select a template above or enter JSON"></textarea> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="input-group"> |
|
|
|
|
|
|
|
<input id="txtPath" name="path" value="{{path}}" placeholder="Enter path" class="form-control"/> |
|
|
|
|
|
|
|
<span class="input-group-btn"> |
|
|
|
|
|
|
|
<button id="submit" class="btn btn-default" type="button">Go!</button> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<br/> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="row"> |
|
|
|
|
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
|
|
<fieldset> |
|
|
|
|
|
|
|
<legend>Result options</legend> |
|
|
|
<div class="radio"> |
|
|
|
<div class="radio"> |
|
|
|
<label> |
|
|
|
<label> |
|
|
|
<input type="radio" name="type" id="optTypeValue" value="value" {{value-checked}} /> |
|
|
|
<input type="radio" name="rbType" value="VALUE" checked/> |
|
|
|
Matching values |
|
|
|
Matching values |
|
|
|
</label> |
|
|
|
</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="radio"> |
|
|
|
<div class="radio"> |
|
|
|
<label> |
|
|
|
<label> |
|
|
|
<input type="radio" name="type" id="optTypePath" value="path" {{path-checked}} /> |
|
|
|
<input type="radio" name="rbType" value="PATH"/> |
|
|
|
Normalized path expressions |
|
|
|
Normalized path expressions |
|
|
|
</label> |
|
|
|
</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
</fieldset> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="input-group"> |
|
|
|
<div class="col-md-6"> |
|
|
|
<input id="path" name="path" value="{{path}}" placeholder="Enter path" class="form-control"/> |
|
|
|
<fieldset> |
|
|
|
<span class="input-group-btn"> |
|
|
|
<legend>Jayway options</legend> |
|
|
|
<button class="btn btn-default" type="submit">Go!</button> |
|
|
|
<div class="checkbox"> |
|
|
|
</span> |
|
|
|
<label> |
|
|
|
|
|
|
|
<input type="checkbox" name="flagWrap" id="cbFlagWrap" /> |
|
|
|
|
|
|
|
Always return result as list |
|
|
|
|
|
|
|
</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="checkbox"> |
|
|
|
|
|
|
|
<label> |
|
|
|
|
|
|
|
<input type="checkbox" name="flagMerge" id="cbFlagMerge" /> |
|
|
|
|
|
|
|
Merge multi props to new object |
|
|
|
|
|
|
|
</label> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="checkbox"> |
|
|
|
|
|
|
|
<label> |
|
|
|
|
|
|
|
<input type="checkbox" name="flagSuppress" id="cbFlagSuppress" /> |
|
|
|
|
|
|
|
Suppress exceptions |
|
|
|
|
|
|
|
</label> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</fieldset> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</form> |
|
|
|
</form> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="col-md-6"> |
|
|
|
<div class="col-md-6"> |
|
|
|
|
|
|
|
|
|
|
|
<ul id="tabs" class="nav nav-tabs" data-tabs="tabs"> |
|
|
|
<ul id="tabs" class="nav nav-tabs" data-tabs="tabs"> |
|
|
|
<li class="active"><a href="#jayway" data-toggle="tab">Jayway</a></li> |
|
|
|
<li class="active"><a href="#jayway-tab" data-toggle="tab">Jayway</a></li> |
|
|
|
<li><a href="#boon" data-toggle="tab">Boon</a></li> |
|
|
|
<li><a href="#boon-tab" data-toggle="tab">Boon</a></li> |
|
|
|
<li><a href="#nebhale" data-toggle="tab">Nebhale</a></li> |
|
|
|
<li><a href="#nebhale-tab" data-toggle="tab">Nebhale</a></li> |
|
|
|
<li><a href="#goessner" data-toggle="tab">Gossner</a></li> |
|
|
|
<li><a href="#goessner-tab" data-toggle="tab">Gossner</a></li> |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
|
|
|
|
|
|
|
|
<div id="my-tab-content" class="tab-content"> |
|
|
|
<div id="my-tab-content" class="tab-content"> |
|
|
|
{{#results}} |
|
|
|
|
|
|
|
<div class="tab-pane {{active}}" id="{{provider}}"> |
|
|
|
<div class="tab-pane active" id="jayway-tab"> |
|
|
|
|
|
|
|
<br/> |
|
|
|
|
|
|
|
<span id="jayway-time"></span> millis |
|
|
|
|
|
|
|
<hr/> |
|
|
|
|
|
|
|
<div class="row"> |
|
|
|
|
|
|
|
<div class="col-md-12"> |
|
|
|
|
|
|
|
<pre id="jayway-res" class="prettyprint" style="background-color: transparent; border: none;"></pre> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<p id="jayway-error" class="bg-danger"></p> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="tab-pane" id="boon-tab"> |
|
|
|
|
|
|
|
<br/> |
|
|
|
|
|
|
|
<span id="boon-time"></span> millis |
|
|
|
|
|
|
|
<hr/> |
|
|
|
|
|
|
|
<div class="row"> |
|
|
|
|
|
|
|
<div class="col-md-12"> |
|
|
|
|
|
|
|
<pre id="boon-res" class="prettyprint" style="background-color: transparent; border: none;"></pre> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<p id="boon-error" class="bg-danger"></p> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="tab-pane" id="nebhale-tab"> |
|
|
|
<br/> |
|
|
|
<br/> |
|
|
|
<span id="{{provider}}-time">{{time}}</span> millis |
|
|
|
<span id="nebhale-time"></span> millis |
|
|
|
<hr/> |
|
|
|
<hr/> |
|
|
|
{{^error}} |
|
|
|
|
|
|
|
<div class="row"> |
|
|
|
<div class="row"> |
|
|
|
<div class="col-md-12"> |
|
|
|
<div class="col-md-12"> |
|
|
|
<pre class="prettyprint" style="background-color: transparent; border: none;">{{result}}</pre> |
|
|
|
<pre id="nebhale-res" class="prettyprint" style="background-color: transparent; border: none;"></pre> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{{/error}} |
|
|
|
<p id="nebhale-error" class="bg-danger"></p> |
|
|
|
{{#error}} |
|
|
|
|
|
|
|
<p class="bg-danger">{{error}}</p> |
|
|
|
|
|
|
|
{{/error}} |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{{/results}} |
|
|
|
|
|
|
|
<div class="tab-pane" id="goessner"> |
|
|
|
<div class="tab-pane" id="goessner-tab"> |
|
|
|
<br/> |
|
|
|
<br/> |
|
|
|
<span id="goessner-time"></span> millis |
|
|
|
<span id="goessner-time"></span> millis |
|
|
|
<hr/> |
|
|
|
<hr/> |
|
|
@ -88,31 +147,87 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</body> |
|
|
|
</body> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
|
|
|
|
|
|
|
|
$( document ).ready(function() { |
|
|
|
$( document ).ready(function() { |
|
|
|
if( $('#jayway').length ) |
|
|
|
$('#selTemplates').on('change', function() { |
|
|
|
{ |
|
|
|
var val = this.value; |
|
|
|
//var value = $("#optTypeValue").prop("checked", true); |
|
|
|
$.ajax({ |
|
|
|
var value = $("#optTypeValue").is(':checked'); |
|
|
|
url: "/templates/" + val, |
|
|
|
var start = new Date().getTime(); |
|
|
|
success: function(data){ |
|
|
|
var json = JSON.parse($('#json').val()); |
|
|
|
if(data){ |
|
|
|
var path = $('#path').val(); |
|
|
|
data = JSON.stringify(data, null, ' '); |
|
|
|
var res = ''; |
|
|
|
} |
|
|
|
if(value){ |
|
|
|
$("#txtJson").val(data); |
|
|
|
res = jsonPath(json, path, {resultType:"VALUE"}); |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#submit').on('click', function() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var json = $('#txtJson').val(); |
|
|
|
|
|
|
|
var path = $('#txtPath').val(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var data = { |
|
|
|
|
|
|
|
json: json, |
|
|
|
|
|
|
|
path: path, |
|
|
|
|
|
|
|
type: $('input[name=rbType]:checked', '#form').val(), |
|
|
|
|
|
|
|
flagWrap: $('#cbFlagWrap').prop('checked'), |
|
|
|
|
|
|
|
flagMerge: $('#cbFlagMerge').prop('checked'), |
|
|
|
|
|
|
|
flagSuppress: $('#cbFlagSuppress').prop('checked') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
console.log(data); |
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
|
|
url: "/eval", |
|
|
|
|
|
|
|
type: 'POST', |
|
|
|
|
|
|
|
dataType: 'json', |
|
|
|
|
|
|
|
data: data, |
|
|
|
|
|
|
|
success: function(data) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#jayway-time').text(data.jayway.time); |
|
|
|
|
|
|
|
$('#jayway-res').text(data.jayway.result).effect( "highlight", {color: '#428bca'} ); |
|
|
|
|
|
|
|
if(data.jayway.error){ |
|
|
|
|
|
|
|
$('#jayway-error').text(data.jayway.error).show(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$('#jayway-error').css( "display", "none") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#boon-time').text(data.boon.time); |
|
|
|
|
|
|
|
$('#boon-res').text(data.boon.result).effect( "highlight", {color: '#428bca'} ); |
|
|
|
|
|
|
|
if(data.boon.error){ |
|
|
|
|
|
|
|
$('#boon-error').text(data.boon.error).show(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
res = jsonPath(json, path, {resultType:"PATH"}); |
|
|
|
$('#boon-error').css( "display", "none") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#nebhale-time').text(data.nebhale.time); |
|
|
|
|
|
|
|
$('#nebhale-res').text(data.nebhale.result).effect( "highlight", {color: '#428bca'} ); |
|
|
|
|
|
|
|
if(data.nebhale.error){ |
|
|
|
|
|
|
|
$('#nebhale-error').text(data.nebhale.error).show(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$('#nebhale-error').css( "display", "none") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var start = new Date().getTime(); |
|
|
|
|
|
|
|
var res = jsonPath(JSON.parse(json), path, {resultType: $('input[name=rbType]:checked', '#form').val() }); |
|
|
|
var elapsed = new Date().getTime() - start; |
|
|
|
var elapsed = new Date().getTime() - start; |
|
|
|
|
|
|
|
|
|
|
|
$("#goessner-time").html(elapsed); |
|
|
|
$("#goessner-time").text(elapsed); |
|
|
|
$("#goessner-res").text(JSON.stringify(res, null, ' ')); |
|
|
|
$("#goessner-res").text(JSON.stringify(res, null, ' ')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('.prettyprinted').removeClass('prettyprinted'); |
|
|
|
|
|
|
|
prettyPrint(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
</html> |
|
|
|
</html> |