# Write JSON string to OPC-UA InputArguments Method

**URL:** <https://discourse.nodered.org/t/write-json-string-to-opc-ua-inputarguments-method/67178>\
**Category:** General\
**Created:** [31 August 2022 12:49 UTC](https://discourse.nodered.org/t/write-json-string-to-opc-ua-inputarguments-method/67178 "2022-08-31T12:49:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HakanOlsson71](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hakanolsson71/32/67157_2.png) [@HakanOlsson71](https://discourse.nodered.org/u/HakanOlsson71)\
**Post date:** [31 August 2022 12:49 UTC](https://discourse.nodered.org/t/write-json-string-to-opc-ua-inputarguments-method/67178/1 "2022-08-31T12:49:06Z")

</div>

Hi  
I’m using “ **node-red-contrib-opcua** ” and trying to write a JSON string to an InputArguments methodId with the help of OpcUA-Method node.  
I can read data from the corresponding outputArguments method. But I can’t figure out how to write the code in my function node to puch the content of a JSON string to an OPCUA Method.  
Below is the script I’m using in my function node to read data (taken from the example from “node-red-contrib-opcua” documentation \<[link](https://github.com/mikakaraila/node-red-contrib-opcua/blob/master/examples/METHOD.json)\>):

```auto
msg.objectId = "ns=2;i=5476";
msg.methodId = "ns=2;i=8106";
return msg;

```

Anyone that can help me?  
Best Regards //Håkan

---

<div class="post-metadata">

**Author:** ![HakanOlsson71](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hakanolsson71/32/67157_2.png) [@HakanOlsson71](https://discourse.nodered.org/u/HakanOlsson71)\
**Post date:** [1 September 2022 08:54 UTC](https://discourse.nodered.org/t/write-json-string-to-opc-ua-inputarguments-method/67178/2 "2022-09-01T08:54:30Z")

</div>

After som trial and error I manage to find a way how to write a JSON string to and inputArgument method.

F.Y.I. This is the syntax I used in my function node:

```auto
var Str = msg.payload

msg.objectId = "ns=2;i=5476";
msg.methodId = "ns=2;i=8080";
msg.methodType = 'basic'

msg.inputArguments = [{ dataType: "String", arrayType: "Scalar", value: Str}];

return msg;

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 September 2022 08:55 UTC](https://discourse.nodered.org/t/write-json-string-to-opc-ua-inputarguments-method/67178/3 "2022-09-15T08:55:05Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
