5
Anakata
4y

What is this format? Spaces are separated by + sign and columns are separated by & sign and it’s value is followed by = sign. Can I directly convert it to Spark dataframe?

Comments
  • 7
    application/x-www-form-urlencoded is my guess. You programming language should have something (likely in a http library) to convert it to a Map.
  • 3
    Not sure about the spaces being replaced with + instead of %20 (though I've seen it around, it's pretty common, I just don't know what standard it is using)

    but otherwise yep, this is just a normal URL query params format, probably coming from a data source like <form> or a js call somewhere with

    Content-Type: application/x-www-form-urlencoded

    which literally just dumps fields as query params.

    each & separates a key=value pair

    not sure about a spark dataframe, but you can literally convert it into a Json by replacing "&" with a (",") and (=) with (":")

    so

    Key1=Val1&Key2=Val2

    turns into

    Key1": "Val1", "Key2": "Val2

    and then just add {" at the start and "} at the end to get

    {"Key1": "Val1", "Key2": "Val2"}

    and I bet there's a way to get a spark dataframe from a json these days
  • 3
    @Hazarth The + is pretty standard

    I.E. google.com/search?q=two+words
  • 2
    @ThisIsOra ye, I noticed it. Just not personally sure why + over %20 as normal url encoding...

    But that's just my inexperience with this
  • 5
    @Hazarth + is i think the older standard as its been around since the beginning, at least early 90s
  • 0
    Looks Like a URL with PHP stuff to be honest
  • 0
    @Ranchonyx now I’m intrigued. Where do you get the PHP from that?
  • 0
    @Hazarth That was very helpful. Thank you!
Add Comment