×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Vim
Posted by: Roman Ignatov
Added: Nov 22, 2016 4:26 PM
Views: 14
Tags: helper vim
  1. Vim Multiple search and replace
  2.  
  3. :%s/":"/" => "/ge | %s/":{/" => [/ge | %s/":\[/" => [/ge | %s/{/[/ge | %s/}/]/ge
  4.  
  5.  
  6. To convert something like this:
  7.  
  8. {
  9.   "requestType":"TourListRequest",
  10.   "data":{
  11.     "ApiKey":"cdqu60CykKeca1Qc000VXwgchV000L2fNOOf0bv9gPp",
  12.     "ResellerId":"1000",
  13.     "SupplierId":"1004",
  14.     "ExternalReference":"10051374722994001",
  15.     "Timestamp":"2016-05-09 08:43:46",
  16.     "Extension":{
  17.       "any":{
  18.        
  19.       }
  20.     },
  21.     "Parameter":{
  22.       "Name":{
  23.         "0":" "
  24.       },
  25.       "Value":{
  26.        
  27.       }
  28.     }
  29.   }
  30. }
  31.  
  32. to PHP array, loke this
  33.  
  34. [
  35.   "requestType" => "TourListRequest",
  36.   "data" => [
  37.     "ApiKey" => "cdqu60CykKeca1Qc000VXwgchV000L2fNOOf0bv9gPp",
  38.     "ResellerId" => "1000",
  39.     "SupplierId" => "1004",
  40.     "ExternalReference" => "10051374722994001",
  41.     "Timestamp" => "2016-05-09 08:43:46",
  42.     "Extension" => [
  43.       "any" => [
  44.        
  45.       ]
  46.     ],
  47.     "Parameter" => [
  48.       "Name" => [
  49.         "0" => " "
  50.       ],
  51.       "Value" => [
  52.        
  53.       ]
  54.     ]
  55.   ]
  56. ]
  57.  
  58.  
  59.  
  60.