title: Split json like string with C++20 ranges/views
body: <p>I have the following string:</p>
  <pre><code>std::string ob = R&quot;({ &quot;U&quot; : 972448093270,&quot;u&quot; : 972448098626,&quot;pu&quot; : 972448093117,&quot;b&quot; : [[&quot;54019.38&quot;,&quot;0.414&quot;],[&quot;54016.91&quot;,&quot;0.002&quot;],[&quot;54016.80&quot;,&quot;0.180&quot;],[&quot;54016.51&quot;,&quot;0.001&quot;],[&quot;54012.74&quot;,&quot;0.001&quot;],[&quot;54012.38&quot;,&quot;0.001&quot;],[&quot;54011.65&quot;,&quot;0.044&quot;],[&quot;54011.57&quot;,&quot;0.005&quot;],[&quot;54011.40&quot;,&quot;0.001&quot;],[&quot;54011.27&quot;,&quot;0.200&quot;],[&quot;54011.26&quot;,&quot;0.200&quot;],[&quot;54011.25&quot;,&quot;0.784&quot;],[&quot;54011.12&quot;,&quot;0.200&quot;],[&quot;54011.11&quot;,&quot;0.312&quot;],[&quot;54011.04&quot;,&quot;1.920&quot;],[&quot;54010.67&quot;,&quot;0.123&quot;],[&quot;54010.39&quot;,&quot;0.025&quot;],[&quot;54008.59&quot;,&quot;0.074&quot;],[&quot;54008.58&quot;,&quot;0.167&quot;],[&quot;54008.06&quot;,&quot;0.010&quot;]]})&quot;;
  </code></pre>
  <p>Starting from <code>&quot;b&quot;</code> I want all the numbers split and joined in a vector, so effectively I want my vector to look like this:</p>
  <pre><code>54019.38  0.414  54016.91  etc
  </code></pre>
  <p>I have implemented the followint with C++20 ranges/views</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;ranges&gt;
  
  auto to_vector(auto&amp;&amp; rng) 
  {
      std::vector&lt;std::ranges::range_value_t&lt;decltype(rng)&gt;&gt; v;
      if constexpr (std::ranges::sized_range&lt;decltype(rng)&gt;) {
          v.reserve(std::ranges::size(rng));
      }
      std::ranges::copy(rng, std::back_inserter(v));
      return v;
  }
  
  int main() 
  {
      
      std::string ob = R&quot;({ &quot;U&quot; : 972448093270,&quot;u&quot; : 972448098626,&quot;pu&quot; : 972448093117,&quot;b&quot; : [[&quot;54019.38&quot;,&quot;0.414&quot;],[&quot;54016.91&quot;,&quot;0.002&quot;],[&quot;54016.80&quot;,&quot;0.180&quot;],[&quot;54016.51&quot;,&quot;0.001&quot;],[&quot;54012.74&quot;,&quot;0.001&quot;],[&quot;54012.38&quot;,&quot;0.001&quot;],[&quot;54011.65&quot;,&quot;0.044&quot;],[&quot;54011.57&quot;,&quot;0.005&quot;],[&quot;54011.40&quot;,&quot;0.001&quot;],[&quot;54011.27&quot;,&quot;0.200&quot;],[&quot;54011.26&quot;,&quot;0.200&quot;],[&quot;54011.25&quot;,&quot;0.784&quot;],[&quot;54011.12&quot;,&quot;0.200&quot;],[&quot;54011.11&quot;,&quot;0.312&quot;],[&quot;54011.04&quot;,&quot;1.920&quot;],[&quot;54010.67&quot;,&quot;0.123&quot;],[&quot;54010.39&quot;,&quot;0.025&quot;],[&quot;54008.59&quot;,&quot;0.074&quot;],[&quot;54008.58&quot;,&quot;0.167&quot;],[&quot;54008.06&quot;,&quot;0.010&quot;]]})&quot;;
      auto digits = ob | std::views::drop_while([](auto i) {return i != 'b'; }) | std::views::split('&quot;') | std::views::join;
      auto vec = to_vector(digits);
  
      for (auto const&amp; item : vec) {
          std::cout &lt;&lt; item &lt;&lt;&quot; &quot;;
      }
  }
  </code></pre>
  <p>Unfortunately instead of expected output I got</p>
  <pre><code>`b   :   [ [ 5 4 0 1 9 . 3 8 , 0 . 4 1 4 ] , [ 5 4 0 1 6 . 9 1 , 0 . 0 0 2 ] , [ 5 4 0 1 6 . 8 0 , 0 . 1 8 0 ] , [ 5 4 0 1 6 . 5 1 , 0 . 0 0 1 ] , [ 5 4 0 1 2 . 7 4 , 0 . 0 0 1 ] , [ 5 4 0 1 2 . 3 8 , 0 . 0 0 1 ] , [ 5 4 0 1 1 . 6 5 , 0 . 0 4 4 ] ...etc
  </code></pre>
  <p>So I have each character in a vector individually instead of splitting whatever was between &quot;'s<br />
  Can someone please help me fix this, thanks in advance.</p>