# InputJsonの使用

## **inputjsonパラメータの使用**

アプリケーションは、予約パラメーターの**inputjson**を使用し、JSON形式の値をOZRまたはOZDのコンポーネントに渡すことができます。&#x20;

OZRファイルにパラメーターを定義する必要はありません。OZビューアーは、JSON形式の値をフォーム内の対応するコンポーネントに自動的に渡します。

{% hint style="warning" %}

* JSON文字列の項目名は、各コンポーネントのFormIDと一致する必要があります。
* JSON文字列はエスケープ処理をする必要があります。
  {% endhint %}

```javascript
<script type="text/javascript" >
var serverUrl = "https://" + location.host;
var inputjson = "{\"memberNo\":\"1001\",\"photo\":\"\",\"firstName\":\"ICHIRO\",\"lastName\":\"NAKAMURA\",\"yyyy\":\"1989\",\"mm\":\"09\",\"dd\":\"05\",\"gender\":\"M\",\"contactNo\":\"333-5555-7778\",\"email\":\"nakamura@forcs.com\",\"memberType\":\"Premium\",\"fromDate\":\"2019-12-24\",\"toDate\":\"2020-12-24\",\"cardType\":\"SCBANK\",\"cardNo\":\"1111-2222-3333-4444\",\"cardExpMM\":\"12\",\"cardExpYY\":\"24\"}";
function SetOZParamters_OZViewer(){
	var oz = document.getElementById("OZViewer");
	oz.sendToActionScript("information.debug", "true"); // viewer console
	oz.sendToActionScript("connection.servlet",serverUrl + "/oz/server");
	oz.sendToActionScript("connection.reportname","/eform/membership.ozr");
	oz.sendToActionScript("connection.inputjson", inputjson);
	oz.sendToActionScript("etcmenu.copyinputdata_json", "true"); // enable [Copy input data (json)] option in etc menu
	return true;
}
start_ozjs("OZViewer", serverUrl + "/oz/HTML5viewer/");
</script>
```

[Run example](https://demo.ozeform.io/oz/eform/membership-inputjson.html)

{% file src="/files/-M4IKtezbxFc5FF9j\_jt" %}
samples-prefill-components.zip
{% endfile %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jp.ozeform.io/bjonbakkuappu/oz-viewer-study/inputjsonno.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
