title: How to convert sql-text to jsonb-string?
body: <p>There does not seem to be an obvious way:</p>
  <ul>
  <li><code>select 'a123'::text::jsonb</code> = <em>ERROR:  invalid input syntax for type json</em></li>
  <li><code>select '&quot;a123&quot;'::text::jsonb</code> = <strong>BAD string</strong> because quoted<br/>check <code>select '&quot;a123&quot;'::text::jsonb = ('{&quot;x&quot;:&quot;a123&quot;}'::jsonb)-&gt;'x'</code><br/>to see that <strong>non-quoted is the correct</strong>.</li>
  <li><code>select '123'::text::jsonb = ('{&quot;x&quot;:123}'::jsonb)-&gt;'x';</code> = <strong>NOT string</strong></li>
  </ul>
  <p>I need '123' and 'a123' as <strong>pure JSONb strings</strong>.</p>
  <hr />
  <p>PS: it is not a duplicate of <a href="https://stackoverflow.com/q/41924784/287948">generic automatic-anything conversion</a>.</p>