Migrate existing data when altering the column type from string to json
Rather than making up any keys, why not convert that to a json array?
alter table the_table
  alter column the_column type jsonb 
  using to_jsonb(string_to_array(the_column, ':'));

That would turn str1:str2 into [&quot;str1&quot;, &quot;str2&quot;]
If you really need to make up some (numbered keys), you will have to write a helper function:
create function make_json_keys(p_input text)
returns jsonb
as
$$
  select jsonb_object_agg('key'||idx, val)
  from unnest(string_to_array(p_input, ':')) with ordinality as t(val, idx);
$$
language sql
immutable;  

That can be used in the USING expression:
alter table the_table
  alter column the_column type jsonb 
  using make_json_keys(the_column);