title: What is the most effective way to minimize data for transfer over UDP?
body: <p>I'm not into bits and bytes too much, so my apologies if this question is stupid.</p>
  
  <p>I have some experience with sockets, usually for transferring small amounts of plain text. This time however I have to transfer much more data that I'm able to break apart via UDP.</p>
  
  <p>I'm developing a game, where the server is written in Java and I want to send an array of objects to the client. Since I'm a webdeveloper JSON is the first thing that pops up for transferring data though I highly doubt this is the most effective way in networking.</p>
  
  <p>In case of JSON:</p>
  
  <pre><code>{
      "players": [
          {
              "id": "884B0EAA2C7F16BA",   // hex string
              "name": "some guy",         // string
              "x": 0,                     // double
              "y": 0,                     // double
              "xv": 0,                    // double
              "yv": 0,                    // double
              "angle": 0,                 // double
          }, {
              "id": "AB61F7C2AAE0B488",   // hex string
              "name": "some other guy",   // string
              "x": 0,                     // double
              "y": 0,                     // double
              "xv": 0,                    // double
              "yv": 0,                    // double
              "angle": 0,                 // double
          }
      ]
  }
  </code></pre>
  
  <p>Now, I could just add a custom delimiter to split data per player and another delimiter to split data. In my optics, one of the most effective ways would be to put the values of the player per line, and put a predefined character sequence between the values.</p>
  
  <pre><code>884B0EAA2C7F16BA[|]some guy[|]0[|]0[|]0[|]0[|]0
  AB61F7C2AAE0B488[|]some other guy[|]0[|]0[|]0[|]0[|]0
  </code></pre>
  
  <p>Though this will work for me, there are still some security risks with names and such. I hardly can tell the client that a display name containing "[|]" is illegal.</p>
  
  <p><strong>What is the most effective way to minimize data for transfer?</strong></p>
  
  <p>Any additional information about encryption will be much appreciated!</p>