# Protobuf data encoding

**URL:** <https://forum.inductiveautomation.com/t/protobuf-data-encoding/97572>\
**Category:** General Discussion\
**Created:** [October 21, 2024, 9:52pm UTC](https://forum.inductiveautomation.com/t/protobuf-data-encoding/97572 "2024-10-21T21:52:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tamerplc](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tamerplc](https://forum.inductiveautomation.com/u/tamerplc)\
**Post date:** [October 21, 2024, 9:52pm UTC](https://forum.inductiveautomation.com/t/protobuf-data-encoding/97572/1 "2024-10-21T21:52:29Z")

</div>

Hi,  
able to send metric data collected from different tags as JSON format to other system using APIs.. challenge now they need the data in protobuf encoding format . Is there any guidance to do that

> {  
> "metrics": [  
> {  
> "tagName": "speed1",  
> "value": 92.02906036376953,  
> "timestamp": 1729546154762  
> },  
> {  
> "tagName": "speed2",  
> "value": 92.02906036376953,  
> "timestamp": 1729546154763  
> },  
> {  
> "tagName": "temp1",  
> "value": 41.07870101928711,  
> "timestamp": 1729546154765  
> },  
> {  
> "tagName": "temp2",  
> "value": 92.02906036376953,  
> "timestamp": 1729546154767  
> }  
> ]

---

<div class="post-metadata">

**Author:** ![tamerplc](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tamerplc](https://forum.inductiveautomation.com/u/tamerplc)\
**Post date:** [October 22, 2024, 9:39pm UTC](https://forum.inductiveautomation.com/t/protobuf-data-encoding/97572/2 "2024-10-22T21:39:42Z")

</div>

Notice Ignition 8.3 going to use protoBuf for EAM .. I hope to get some guidance or way of work to be able to use protobuf encoding

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/9/59b11eb6751becca2c9cb120830322c2df64b00b.jpeg)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 22, 2024, 10:18pm UTC](https://forum.inductiveautomation.com/t/protobuf-data-encoding/97572/3 "2024-10-22T22:18:47Z")

</div>

"Protobuf" is a very broad umbrella. Protobuf is a schemaless encoding, so it cannot be written or read by either end without out-of-band communication to share message formats. That is, two totally different protobuf messages could have exactly the same binary representation on the wire. Ignition's use of protobuf is probably not going to help you with whatever you're trying to do.

---

<div class="post-metadata">

**Author:** ![tamerplc](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tamerplc](https://forum.inductiveautomation.com/u/tamerplc)\
**Post date:** [October 22, 2024, 10:25pm UTC](https://forum.inductiveautomation.com/t/protobuf-data-encoding/97572/4 "2024-10-22T22:25:43Z")

</div>

The only way if found is using protobuf python library but it has some C dependency on C. Thus why we can't import it to pylib in ignition .

other way to use Flask as and end point to encoding outside ignition then get the result and pass to APIs to consumer ..

is my way of thinking is right or there's better approach .

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 22, 2024, 10:34pm UTC](https://forum.inductiveautomation.com/t/protobuf-data-encoding/97572/5 "2024-10-22T22:34:44Z")

</div>

You _cannot_ do anything without the protobuf schemas for whatever you're trying to talk to. You could, in theory, either then use these to code-generate some _Java_ code (what I'd recommend) that you then use from Jython, or try to find a pure-Python library (that works on Python 2.7) that you can integrate and use to generate the appropriate binary data at runtime.

---

<div class="post-metadata">

**Author:** ![tamerplc](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tamerplc](https://forum.inductiveautomation.com/u/tamerplc)\
**Post date:** [October 22, 2024, 10:43pm UTC](https://forum.inductiveautomation.com/t/protobuf-data-encoding/97572/6 "2024-10-22T22:43:41Z")

</div>

Yes, Schema created and store in \*.proto file ..  
there's no pure-pyhton library to be used with jython2.7 .

> [@paul-griffith](#):
>
> either then use these to code-generate some _Java_ code (what I'd recommend)

How to start with this approach ?

---

<div class="post-metadata">

**Author:** ![tamerplc](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tamerplc](https://forum.inductiveautomation.com/u/tamerplc)\
**Post date:** [October 23, 2024, 10:53pm UTC](https://forum.inductiveautomation.com/t/protobuf-data-encoding/97572/7 "2024-10-23T22:53:44Z")

</div>

it's working after getting some guidance from Ignition support team 😀

1. Define the Protobuf schema that describes the structure of the data you want to serialize/deserialize. This schema file (`.proto`) defines the types and structure of the messages.

2. Generate Java code from the Protobuf schema using a Protobuf compiler (`protoc`) to generate Java classes from the `.proto` schema file.

- The `protoc` compiler reads the `.proto` file and outputs Java source files corresponding to the schema.

1. Compile the generated Java code using a Java compiler (`javac`).
2. Use the generated Java code by adding the compiled Java classes & JAR file to Ignition, then importing these classes within your script.
3. Now serialize/deserialize Protobuf messages using the generated code in your script.
