<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="327071" data-post-id="327071">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="03juan" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/03juan/120/23111_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  03juan
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="silverdr" data-post="11" data-topic="63306">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/silverdr/48/23771_2.png" class="avatar"> silverdr:</div>
<blockquote>
<p>Huh, yes - I already was halfway there with array of maps but that seems like an overkill for a theoretically simple problem, doesn’t it?</p>
</blockquote>
</aside>
<p>As always, it depends on the needs. The embedded schema implementation at least uses the pre-existing Ecto niceties and you can decide what structure makes the most sense for your real business requirements.</p>
<aside class="quote no-group" data-username="silverdr" data-post="11" data-topic="63306">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/silverdr/48/23771_2.png" class="avatar"> silverdr:</div>
<blockquote>
<p>BTW in Ruby, starting with a don’t remember exactly which version (2.0?) the guys made Ruby hashmaps always preserve the order of keys. That one step made this class of problems as here simply disappear.</p>
</blockquote>
</aside>
<p>Ah yes, good old <code>hashmapwithindifferentaccess</code>, unfortunately we have to contend with erlang’s map implementation in C, but hey, you can always convert the list of tuples to <a href="https://www.erlang.org/doc/man/gb_trees" rel="nofollow">gb_trees</a> <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327071" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-represent-keyword-list-in-ecto-ecto-schema/63306/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-327071" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327071"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="327072" data-post-id="327072">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="03juan" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/03juan/120/23111_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  03juan
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yes, exactly why the schema should just be a way to store the data in the DB, and you’d write a module for the real data structure that hides these implementation details. Like MapSet is just opaque Map under the hood.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327072" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-represent-keyword-list-in-ecto-ecto-schema/63306/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-327072" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327072"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="327075" data-post-id="327075">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="silverdr" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/silverdr/120/23771_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  silverdr
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="03juan" data-post="12" data-topic="63306">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/03juan/48/23111_2.png" class="avatar"> 03juan:</div>
<blockquote>
<p>Ah yes, good old <code>hashmapwithindifferentaccess</code></p>
</blockquote>
</aside>
<p>No, that’s a different thing (and not a Ruby one AFAIR). Indifferent access means that accessing may be done using either atoms or binaries (indifferent) without having to worry how the hashmap was created. What I refer to is LMGTFM… this:</p>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://ruby-doc.org/3.3.1/Hash.html#class-Hash-label-Entry+Order">
  <header class="source">

      <a href="https://ruby-doc.org/3.3.1/Hash.html#class-Hash-label-Entry+Order" target="_blank" rel="noopener nofollow ugc">ruby-doc.org</a>
  </header>

  <article class="onebox-body">
    

<h3><a href="https://ruby-doc.org/3.3.1/Hash.html#class-Hash-label-Entry+Order" target="_blank" rel="noopener nofollow ugc">class Hash - RDoc Documentation</a></h3>



  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>I think it was introduced in 2.0 some years ago and I even recall I used it in similar problem and guy called me on that during code review, until I showed that it’s a documented feature already <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327075" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-represent-keyword-list-in-ecto-ecto-schema/63306/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-327075" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327075"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="327076" data-post-id="327076">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="fmn" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/fmn/120/26825_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  fmn
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="silverdr" data-post="4" data-topic="63306">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/silverdr/48/23771_2.png" class="avatar"> silverdr:</div>
<blockquote>
<p>How do I quickly get the value for <code>b:</code> (or whichever) key?</p>
</blockquote>
</aside>
<p>how quick it is, for that data type is relative to its size (or rather length), because you need to scan it whole or until you will find <code>:b</code>, if those “keys” are unique.</p>
<p>to find it really quickly, you probably would need to use a <code>MapSet</code> or a <code>Map</code>, i guess?</p>
<p>EDIT: or a pattern match if you know its length? but i am not sure how fast it is.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327076" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-represent-keyword-list-in-ecto-ecto-schema/63306/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-327076" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327076"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="327077" data-post-id="327077">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="thousandsofthem" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/thousandsofthem/120/1030_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  thousandsofthem
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Very much depends on exact restrictions.<br>
If keys can not be repeated, just do plain map (jsonb).<br>
If you need to store exact value type, serialize it and store as binary blob</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">:erlang.term_to_binary([a: 5, b: "five", c: :five])
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327077" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-represent-keyword-list-in-ecto-ecto-schema/63306/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-327077" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327077"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="327078" data-post-id="327078">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="joey_the_snake" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  joey_the_snake
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="silverdr" data-post="1" data-topic="63306">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/silverdr/48/23771_2.png" class="avatar"> silverdr:</div>
<blockquote>
<p>how does one represent it in Ecto so that it serialises well into JSON column</p>
</blockquote>
</aside>
<p>In my opinion the best way to solve issues like this is to first decide how you would represent it in the database if you weren’t using Ecto. Keep in mind Ecto is just defining a mapping between Elixir and your persistence layer. If you don’t know what you want to do in your persistence layer you don’t know what you want to do in Ecto.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327078" data-batch-url="/posts/batch_likers">
                        5
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-represent-keyword-list-in-ecto-ecto-schema/63306/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-327078" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327078"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="327079" data-post-id="327079">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="silverdr" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/silverdr/120/23771_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  silverdr
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="thousandsofthem" data-post="16" data-topic="63306">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/thousandsofthem/48/1030_2.png" class="avatar"> thousandsofthem:</div>
<blockquote>
<p>If keys can not be repeated, just do plain map (jsonb)</p>
</blockquote>
</aside>
<p>Keys are unique but their order is important. I’d love to just serialise the Map and be done but in Elixir (Erlang/OTP) that does not guarantee that the order will be preserved.</p>
<aside class="quote no-group" data-username="thousandsofthem" data-post="16" data-topic="63306">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/thousandsofthem/48/1030_2.png" class="avatar"> thousandsofthem:</div>
<blockquote>
<p>If you need to store exact value type, serialize it and store as binary blob</p>
</blockquote>
</aside>
<p>It needs to fit into an existing JSON structure. While it doesn’t really need to be human-readable, it would still be nice to have it as an array of JSON “objects” along with everything else. But yes, I guess this could be doable this way, although this would be the only unreadable JSON part then.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327079" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-represent-keyword-list-in-ecto-ecto-schema/63306/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-327079" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327079"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="327080" data-post-id="327080">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="silverdr" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/silverdr/120/23771_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  silverdr
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="joey_the_snake" data-post="17" data-topic="63306">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/j/c37758/48.png" class="avatar"> joey_the_snake:</div>
<blockquote>
<p>first decide how you would represent it in the database if you weren’t using Ecto</p>
</blockquote>
</aside>
<aside class="quote no-group" data-username="joey_the_snake" data-post="17" data-topic="63306">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/j/c37758/48.png" class="avatar"> joey_the_snake:</div>
<blockquote>
<p>If you don’t know what you want to do in your persistence layer you don’t know what you want to do in Ecto</p>
</blockquote>
</aside>
<aside class="quote no-group" data-username="silverdr" data-post="6" data-topic="63306">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/silverdr/48/23771_2.png" class="avatar"> silverdr:</div>
<blockquote>
<p>I hope(d) for an array of JSON “objects”</p>
</blockquote>
</aside>
<p>That’s how I decided I’d prefer to have it but I ran into limitations. I did implement it as a <code>List</code> of single-element <code>Map</code>s but didn’t like the complexity and ineffectiveness of handling those. Still - after reading the comments and realising (thank you <a class="mention" href="/u/ruslandoga" rel="nofollow">@ruslandoga</a>) that I don’t have to reinvent the wheel <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"> this seems like the “least bad” approach, short of custom types</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327080" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-represent-keyword-list-in-ecto-ecto-schema/63306/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-327080" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327080"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #18"></div>
  </section>
</div>
    <div class="postbit" id="327083" data-post-id="327083">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="fmn" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/fmn/120/26825_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  fmn
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="silverdr" data-post="1" data-topic="63306">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/silverdr/48/23771_2.png" class="avatar"> silverdr:</div>
<blockquote>
<p>how does one represent it in Ecto so that it serialises well into JSON column? Do I need to create custom type? Or how would you do it?</p>
</blockquote>
</aside>
<p>if you want to encode it to native JSON types, 1  to 1 - it’s not possible.<br>
if you are flexible, you can encode it into JSON array of two element arrays.</p>
<p>if you want to encode anything more complex - like “ordered sets” or “indexed lists” , you need to:</p>
<ul>
<li>find a way to implement your data type in Elixir (there are no types in Elixir as far as i know supporting all the properties you are looking for; maybe you can find a wrapper around Erlang’s <a href="https://www.erlang.org/doc/man/gb_trees.html" rel="nofollow">gb_tree</a>?)</li>
<li>invent a way of encoding it into JSON and decoding it from JSON (because at “type-to-type” level, types you are looking for are incompatible with JSON types).</li>
</ul>
<p>open question remains: what’s the cost of integrating it into Ecto?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327083" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-represent-keyword-list-in-ecto-ecto-schema/63306/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-327083" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327083"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #19"></div>
  </section>
</div>
    <div class="postbit" id="327087" data-post-id="327087">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dimitarvp" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/120/38664_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dimitarvp
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I would go for two maps handled by a homemade <code>Ecto.Type</code>:</p>
<ul>
<li>key =&gt; value</li>
<li>key =&gt; index</li>
</ul>
<p>When you want to access the key/value pairs in order, just use the second map.</p>
<p>Those two maps can also be wrapped in a single map, no need for two DB table columns either.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327087" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-represent-keyword-list-in-ecto-ecto-schema/63306/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-327087" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327087"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #20"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/63306/load_more?page=3">Load more posts (4 remaining)</a>
</div></template></turbo-stream>