Skip to content

Commit c124e12

Browse files
author
Nikita Stepochkin
committed
feat: add json path for http call
1 parent ba81308 commit c124e12

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

index.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@
130130
<label for="json-input">JSON Data:</label><br>
131131
<textarea class="json-input form-control" rows="10"></textarea><br>
132132
<button class="btn btn-beautify">Beautify JSON</button><br><br>
133-
<label for="json-path">JSON Path (optional):</label><br>
134-
<input type="text" class="json-path form-control" placeholder="e.g., data.chart"><br>
133+
<label for="json-path-json">JSON Path (optional):</label><br>
134+
<input type="text" class="json-path-json form-control" placeholder="e.g., data.chart"><br>
135135
</div>
136136
<div class="view-http hidden">
137137
<form id="requestForm">
@@ -150,6 +150,10 @@
150150
<label for="body">Body</label><br>
151151
<textarea class="http-body form-control" placeholder='{"key1": "value1", "key2": "value2"}'></textarea><br>
152152
</div>
153+
<div class="jsonPathContainer">
154+
<label for="json-path-http">JSON Path (optional):</label><br>
155+
<input type="text" class="json-path-http form-control" placeholder="e.g., data.chart"><br>
156+
</div>
153157
</form>
154158
</div>
155159
<div class="view-chart" style="display:none;">
@@ -227,7 +231,7 @@
227231
try {
228232
if (inputType === 'json') {
229233
const jsonData = box.querySelector('.json-input').value;
230-
const jsonPath = box.querySelector('.json-path').value;
234+
const jsonPath = box.querySelector('.json-path-json').value;
231235
plotData = JSON.parse(jsonData);
232236
if (jsonPath) {
233237
const pathParts = jsonPath.split('.');
@@ -254,7 +258,7 @@
254258
body: method === 'POST' ? body : null
255259
});
256260
const jsonData = await response.json();
257-
const jsonPath = box.querySelector('.json-path').value;
261+
const jsonPath = box.querySelector('.json-path-http').value;
258262
plotData = jsonData;
259263
if (jsonPath) {
260264
const pathParts = jsonPath.split('.');

0 commit comments

Comments
 (0)