Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
urltron
Advanced tools
Readme
Stringify and parse json for url.
Works wonderfully for SPA apps that want to store state in url. Read via location.search
and location.hash
. Navigate with <a href="...">
, history.pushState
and location.assign
. Can be used with react-router
's <Link to={...}
and useLocation/useHistory
hooks.
Same api as built-in JSON.stringify
and JSON.parse
.
import urltron from 'urltron';
urltron.stringify({limit: 10, offset: 20, query: 'hello'});
urltron.parse('limit=10&offset=20&query=hello');
?k1=v&k2=v
.(a=1&b=2&c=3)
and arrays in @(a,b,c)
encodeURIComponent(JSON.stringify(val))
urltron | json |
---|---|
hello=world+tour&limit=2&sort | {"hello":"world tour","limit":2,"sort":true} |
query= | {"query":""} |
num=1.23 | {"num":1.23} |
yep=t | {"yep":true} |
nah=f | {"nah":false} |
nada=n | {"nada":null} |
nStr=~n | {"nStr":"n"} |
numStr=~123 | {"numStr":"123"} |
arr=@(1,2,3) | {"arr":[1,2,3]} |
jraphql=(id&name&books=(id&name)) | {"jraphql":{"id":true,"name":true,"books":{"id":true,"name":true}} |
@(@(1,2,3),@(4,5,6),@(7,8,9),0) | [[1,2,3],[4,5,6],[7,8,9],0] |
@(~,hello,t,f,n,1,(a=(b=c))) | ["","hello",true,false,null,1,{"a":{"b":"c"}}] |
FAQs
Stringify and parse json from url query parameters
The npm package urltron receives a total of 115 weekly downloads. As such, urltron popularity was classified as not popular.
We found that urltron demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.