►
From YouTube: .NET Design Review: JSON
Description
00:00:00 - Approved: Should Utf8JsonReader expose TokenStartIndex? https://github.com/dotnet/corefx/issues/33967
A
A
A
On
the
reader,
the
the
user
can
see
can
get
tokens
from
the
payload
then
and
that
token
stored
inside
or
either
a
sequence
or
a
span,
and
that
they
get
that
to
the
values,
my
property
or
value
seekers
property.
The
thing
that
the
user
does
not
get
access
to
is
where,
in
the
payload,
this
token
starts,
and
there
is
no
good
way
for
the
user
to
compute,
where
the
token
starts
drop
it
out
to
unsafe
code
or
doing
some
interesting
tricks.
A
That
Jamie
did
on
the
gesture
document,
which
only
was
exactly
for
spares
and
that's
because
the
reader
eagerly
eats
whitespace
or
gross.
B
A
Or
a
spare
and
that
they
get
that
it
makes
it
difficult
for
people
to
reason
about
based
on
all
the
different
corner
cases.
What
they
took
is
star
index
would
point
to.
So
the
solution
is
exposed
to
token
start
index
on
the
reader
as
a
property,
I
will
be
an
INT
in
64,
and
that
may
the
caller
does
not
have
to
deal
with
remembering
byte
offsets
or
cracking
bytes
consume
and
doing
some
offsets
of
the
ad
based
on
token
types.
A
So
this
will
give
you
exactly
where,
in
the
payload
the
token
started
for
Strings
and
property
names,
it
would
be
right
before
the
strike
code
and
for
all
other
tokus
would
be
like
right
right
at
where
they're
supposed
to
be,
for
example,
for
started
before
the
square
bracket
square
bracket
for
comets
will
be
right
before
the
double
slash.
When.
A
Exactly
so
on
the
reader
you
have
is
sort
some
of
the
relevant
properties.
We
have
current
depth,
we
have
bite
consumed,
we
have
position
and
token
type
etc.
So
this
was
just
under
than
you
or
property
toka
start
index.
The
only
question
I
had
was
around
naming,
which
is,
do
you
want
it
to
be
value,
stored
index
to
map,
to
value
span,
value
sequence,
or
do
you
want
it
to
be
element
store
index,
Matt,
just
an
element
or
do
we
keep
talking
started
next
because
we
have
to
type
as
well.
B
A
A
Okay,
now
for
the
more
interesting
topic
which
is
escaping
and
encoding,
so
there's
there's
two
prime
to
merge
motivations
for
this
API.
One
of
them
is
the
user,
has
string,
literals
or
known
constant
strings
that
are
already
either
P
escape,
or
they
know
they
don't
need
to
be
a
scared.
The
rider
today
doesn't
provide
an
ability
for
them
to
skip
the
scape
check
and
the
scape
escaping
checking
for
skipping
ends
up
becoming
maybe
ten
to
fifty
percent
slower
based
on
some
particular
payload
and
the
solution.
A
Previously,
the
solution
was
we
just
passed
in
boolean
to
say:
hey,
I
know
this
already
escaped,
don't
escape
and
just
copy
directly
to
the
output
JSON
encoded,
however,
that
lets
users
passing
potentially
invalid
key
fit
or
embedded
course
within
the
spanners
or
you
debate
by
today
they
are
they're
sending.
So
we
want
to
be
able
to
still
validate
and
check
that.
The
straying
that
they're
passing
is
correct
but
skip
the
stepping
check
on
right
and
per
day,
and
if
you
look
at
Allah.
A
A
B
B
G
A
Regarding
the
first
motivation,
around
users
want
to
be
locked
up
into
skipping
escape
check
in
single.
Are
we
have
code
like
this?
Where
you
have
a
little
string
and
you
store
in
a
biker
you,
you
give
a
bike
path,
dialogue
and
set
forth
since
the
user
already
has
this
upfront
cost
anyway.
We,
the
solution,
was
to
get
the
validation
and
do
not
have
the
users
single
like
right.
Bytes
like
this
people,
why
funky
type
or
json
encoded
text
and
you
pass
in
differing
little
etc,
and
you
show
that
is
like
so.
A
Get
to
that,
I
just
I
were
transferred
to
motivations
and
we
get
out
was
a
beard.
So
second
point:
the
reason
why
we
did
this
we
over
escaped
is
for
defense
in
depth.
Aside
from
the
fact
that
users
could
have
string
literals,
they
also
want
customization
of
what
they
want
to
be
asked
what
to
want
to
escape.
So
we
over
scale
escape
the
plus
ampersand,
etc,
but
some
people
wanna
opt
out
of
donors
over
escape
the
noisy
characters,
the
attacked
on
human
readability.
A
The
only
concerned
people's
the
only
performance
we
concerned
that
people
would
this
would
result
in
is
escaping
ends
up
bloating
the
payroll
size
by
to
6x
definitely
alone.
So
people
want
to
shrink
that
as
well.
So
that's
what
they
would
wanna
opt
into
this
behavior.
So
because
these
two
motivations,
we
have
the
least
enjoyed
tax
type.
The
first
three
sets
of
constructors
basically
solves.
The
first
motivation,
which
is,
he
already
know,
is
the
string
literal.
That's
escaped
I'm
not
doing
any
custom.
I
don't
want
customize.
My
skipping
I'll
just
use
default
skipping
logic.
A
B
E
B
E
Another
another
approach
would
be
I,
don't
know
what
you
use
for
escaping
are
using
the
web.
Encoding
said
yes,
but
not
today,
but
this
is
this.
Is
this
I
don't
know
if
you
want
to
take
dependency
in
api's,
but
imagine
that
these
constructors
would
take.
You
know
this.
Caper
is
a
parameter,
then
it's
clear
that
they
will
be
as
if
that's
the
second
set
of
rafters
yeah
wish
to
take
the
JavaScript
in
code.
These
are
very
clear
what
they
are
doing,
I'm
passing
a
string
and
then
this
caper.
Clearly
they
will.
E
E
A
E
B
I
Agree
of
Jeremy
because
the
other
problem
is
even
if
you
got
by
the
intellisense
at
this
encodes
imagine
you
would
look
at
github,
which
just
so
many
submits
at
they
are
so
like
you
just
see.
Basically
the
line
of
code
way.
Somebody
says:
VAR
text
equals
new
json
encoded
text
and
then
some
some
value.
It's
not
clear
whether
that
means
in
code
or
not
like.
I
don't
see
the
constructor
signatures
at
that
point.
So.
E
I
think
it
would
find,
but
then
we
would
not
have
constructors
if
we
don't
have
constructors
there's.
Basically
one
way
of
creating
these
things
is
by
calling
some
encoding
methods.
I.
Think
it's
reasonable
construct.
You
know
it
will
be
a
bit
less
discoverable
like
the
eyes
like
people,
our
customers
tend
to
try
to
find
a
constructor
first,
but
I
think
it's
fine.
What
I
think
would
be
a
mistake
is
to
have
both
the
static
methods
and
constructors
yeah.
B
A
A
Okay,
so
to
go
over
the
rest
of
the
EPS,
and
then
we
can
come
back
to
all
the
rest,
of
course,
on
the
head
we
does.
This
encoder
will
be
the
extension
point
for
in
Jason
Ryder
options
as
well,
so
using
the
pass
in
the
JavaScript
encoder
that
they
want
to
use,
and
we
would
use
that
rather
the
Foley
encoder
while
escaping
this
is
the
way
to
up
like
it's
aside
from
skipping
and
skipping
or
skipping
encoding.
It's
the
user
bunch
of
customized
all
up
I'm
passing
you
data
just
use
this
encoder
that
separated
so.
A
A
I
A
J
A
B
E
And
then
you
would
just
call
write,
write
string
down
code,
no,
it
doesn't
solve
the
problem,
because
I
could
basically
called
encode
method
on
one
encode
it
on
the
one
writer
and
then
pass
the
encoded
text
to
another
writer
that
has
a
different
in
color
set
and
now
yeah
I.
You
know
we'll
get
back
to
the
original
problem.
There
are
mainly
two
different
writers
and
they
may
have
two
different
in
Congress
set
right.
L
L
M
So
that's
not
what
we
have
for
HTML.
What
we
have
for
HTML
is
asp.net,
has
a
has
the
HTML
string
type
where
you
create
that
type,
which
is
a
wrapper
around
data
which
is
already
encoded
and
then,
when
it
gets
written
to
the
wire
the
writer
just
says.
Oh,
it's
already
escaped.
Let
me
just
go
as
is
like
this
is
kind
of
the
same
concept
like
this
is
meant
to
replace
the
boolean
parameter.
This
has
already
escaped.
I
What
the
idea
why
you
would
put
it
on
the
writer
is
to
just
get
the
policy.
What
is
the
default
encoder,
but
once
you
instantiate
it
a
JSON,
encoded
text,
it's
encoded
in
whatever
encoding
you
used
right
or
whatever
encoder
use.
So
if
you,
if
you
call
right,
if
you
get,
if
you
call
in
code
on
one
writer
and
you
get
back
a
JSON
encoded
text
and
you
pass
it
to
another
writer,
it
will
just
write
it
exactly
as
it's
embedding
it
like.
As
that,
guy
was
encoded.
You
know.
E
I
B
Not
acceptable
enough,
why
not
if
it
was,
if
you
built
the
your
your
original
thing
using
a
utf-8
is
legal
and
now
you're
in
a
different
stream.
That
says
that
it's
going
to
be
doing
ASCII
only
or
you
tf7,
then
you
can't
let
utf-8
raw
bytes
go
out.
You
have
to
re-encode
them
for
the
current
transport
right,
but
that's
transcoding
rather
than
the
escaping
right.
Well,.
B
M
A
Effectively
the
90%
use
case
would
be,
somebody
has
string
literals,
they
create
adjacent
encoded
text
on
it
and
it
matches
the
default
escape
or
that
we
use
as
matches
edition
default
escape.
It
was
used
to
create
this
text,
and
the
this
is
value
already
code
is
all
this
true.
There
will
be
the
90%
case
in
a
custom
case
where
somebody
wants
to
use
your
custom.
Escaper
is
when
this
would
be
false
and
we
were
really
following
the
Jason
Ryder's
past
in
a
skipper.
You.
N
E
A
E
E
Equals
is
a
referential
equality.
I
think
we
are
I
mean
like
over-engineering
here.
What
would
you
I
would
just
not
make
it
lazy
and
he
you
know
like
in
most
cases
it
just
works.
We
trying
to
basically
in
colder
escape
the
string
in
the
constructor
of
the
jens's
json
encoded
text
yeah.
Now
we
can
make
it
this
chart,
it
doesn't
need
to
be
a
class
very
lightweight.
E
M
E
E
M
F
I
Encodings
for
for
common
literals
that
you
used
toward
your
code,
but
let's
we
extend
this
at
some
point
to
support
multiple
encoder,
so
you
can
say
you
know
my
first
name
can
either
be
utf-8
or
utf-16
and
I
catch
both
of
them
right.
If
you
then
pass
them
around
as
structs,
and
you
have
basically
lazy
initialization
for
the
other
end,
codings,
then
well.
You're
caching
is
basically
going
down
the
drain
because
basically
you
pass
them
by
value
all
the
time
right.
B
M
So
Allison
can
you
scroll
up
to
where
you
were
exposing
both
the
utf-16
and
the
utf-8
outputs
as
properties,
so
I
think
this
I
think
this
speaks
to
the
point
that
the
mo
was
saying.
So
you
see
those
encoded,
utf-8
string
and
encoded
string
properties
that
are
being
exposed.
If
this
were
a
struct,
we
would
have
to
generate
all
of
those
ahead
of
time
rather
than
on
demand,
as
the
properties
are
accessed.
E
Correct
do
we
have
API
that
consume
utf-16
bellos?
No,
so
we
are
designing
for
like
how
many
times
have
we
made
it?
You
know
the
mistake
in
the
past
of
like
adding
overhead
and
complicating
the
api's
for
some
unclear
future
scenarios.
If
we
are
sure
that
we
don't
have
been
doing
this
then
sure
we
can
discuss
it,
but
it
seems
like
this
is
very
hypothetical.
Wasn't.
M
A
E
A
E
Don't
feel
super
strong
if
there
are
some
reasons
I'm
open,
but
what
I'm
saying
is
when
I
saw
this
time,
my
mentor
model
is
I
constructed
it
it
either.
It
was
for
me
or
a
specified.
Encoder
I
now
have
a
type.
It's
encoded
text,
it's
basically
an
immutable
thing.
Yeah
the
moment.
It's
an
immutable
thing,
it's
very
easy
to
reason.
What's
happening.
There
are
no
like
transcoding
going
on.
You
know
at
runtime
and
whatnot
the
moment
it's
immutable.
We
can
make
it
as
tracked
and
be
done
with
it
and
be
very
lightweight.
E
F
E
M
E
M
A
E
I
also
think
that
it
would
make
it
this
is
what
I
said:
I
started
with
my
mental
model.
This
type
is
called
encoded
text.
I
expect
it
to
be
never
in
encoded,
because
it
is
an
encoded
text
and
then
I
pass
it
to
some
writers
and
it
they
keep
transcoding
at
I
mean
it's
super
surprising.
If
I
discover
the
dead
sexy
what's
happening,
but
you
could.
G
N
B
Like
the
serializer,
the
notion
of
it
ever
having
seen
a
class
before
and
building
jason
encoded
text
for
all
the
property
names
once
it
adds
the
API
that
you
can
serialize
into
an
already
open
writer
that
completely
changes
the
model.
The
person
who
built
the
pre
encoded
string
and
the
person
who
built
the
encoding
options
for
the
writer
are
very
different.
So.
A
B
B
E
M
It's
to
work
like
asp.net,
then
what
it
comes
down
like
what
this
type
represents
is
I.
The
caller
have
asserted
that
these
bytes
are
safe
to
send
on
the
wire,
as
is
like,
that
is
what
asp.net,
HTML
string
type
means.
I.
Think
for
simplicity.
We
should
probably
just
say:
ours
has
the
same
contract
like
if
you
see
an
instance
of
this
someone
somewhere
in
the
stack
who
said
this
is
safe,
has
is
like
I
guarantee
that,
whatever
context
this
is
being
passed
around
in
it's
safe,
yeah.
A
E
By
the
way,
it's
so
full
of
values,
this
is
also
interesting
I
just
so,
there
are
a
lot
of
scenarios
where
the
values
are
also
I
have
a
table.
There
are
five
values
that
I'm
gonna.
Be
writing,
so
it's
not
just
four
values
is
basically,
we
also
have
api's
where
you
can
pass
drinks,
and
then
we
need
a
encoder
right.
There's.
I
E
M
J
M
Api
signature,
you
can
actually
say
I-
expect
it
to
be
very
specifically
encoded
for
the
scenario
I
mean
it
just
makes
it
consume.
That's
also
a
lie.
If
you
look
at
the
jason
writer
options,
as
proposed
here,
asin's
not
taking
in
a
base,
encoder
instance
he's
actually
taking
in
a
JavaScript
encoder
specifically,
but.
E
A
M
M
A
B
A
B
You
have
to
string
because,
if
spring
in
a
coated
string
or
the
same
thing,
that's
always
the
debugger
scenario
there
anyway,
keeping
the
encoder
and
exposing
the
encoder.
Would
let
you
do
things
like
if
you
wanted
to
use
a
different
free
escape
thing,
depending
on
what
your,
what
you're
calling
hub,
yeah.
M
B
M
D
A
I
M
M
E
M
J
I
I
don't
agree
with
the
lazy
functionality.
I
think
that
you
could
create
three
different
and
codings
air
instances.
If
you
need
three
different
versions
and
I
think
it
could
be
immutable.
So.
J
You
pass
in
whatever
you
want
string
car
byte
and
then
you
know
you
can
have
the
option
then
to
encode
to
whatever
value
you
want
string.
Car
byte,
for
example,
I,
don't
know,
I
mean
one
so
say,
for
example,
JSON
encoding
text
because
T
you
know
generic
T
and
then
the
T
is
actually
in
car
byte.
That's
what
you
get
out
of
it.
That's
it!
You
get
one
value
out.
You
can
pass
in
three
different
values
string
car
byte,
but
you
know
why
do
we
have
to
do
the
lazy
git
and
keep
the
value?
A
J
Either
you
when
you,
when
you
call
the
static
constructor
or
whatever
your
factory,
myth
that
you're
gonna
add
on
you,
have
a
choice
of
creating
all
three
values
up
front
and
then
not
having
to
remember
the
encoder
or
you
wait
until
the
get
method
is
called,
which
means
you
have
to
remember
the
encoder
and
then
maybe
the
value
semantics
get
kind
of
broken
at
that
point.
So.
A
J
I'm
suggesting
I'm
thinking
about
it
is
that
if
we
just
narrow
it
down
to
one
value,
string,
car
byte,
jason
quoted
text
of
t
that
he's
gonna
say
what
internally
it's
gonna
encode.
But
then
you
will
allow
you
know
your
three
static
factory
methods
and
you're
gonna
convert
to
that
t
version.
Then
you
just
do
one
accordion
and
it
has
various
abilities.
B
J
So
well,
okay,
it's
well
whether
it's
a
generic
or
three
different
subclasses
whatever,
but
I
mean.
I
think
that
I
think
my
question
is:
what
is
the
scenario
for
changing
the
value
out?
I
mean
for
like
property
names,
for
example.
I
know
I'm
gonna
pass
in
a
fight.
You
know
utf-8
value
and
that's
the
only
thing
I
care
about
I,
don't
want
the
string
version
or
the
car
version
to
be
created
when
I
know
the.
M
The
scenario
the
scenario
is
when
all
of
this
is
released
and
customers
ask:
why
can't
I
just
call
Jason
dot
serialized
and
have
a
return
of
string
like
I
want
to
serialize
this
object
and
return
an
actual
system.
Doctoring
instance
like
we're.
We
know
we're
going
to
get
that
request.
We
have
that
API
ready,
yeah.
O
M
A
J
D
J
J
M
J
A
E
Basically,
you
must
parameter
to
the
income
method
to
the
constructor
and
say
I
only
want
you
f/8,
eager
or
both
eager
and
then,
if
you
say
only
one
eager,
then
yes,
if
you
could
keep
pulling
on
utf-16
you're
gonna
get
transcoded
every
single
time
and
if
you
say
both
eager,
then
you
know
we
stir
both.
But
I
would
start
with
a
very
simple
struct
with
one
field
transcodes
and
in
the
you
know
in
the
constructor,
and
it's
done
we
it's
like
Louis.
F
B
E
E
E
E
E
A
M
P
M
M
N
A
So
class
was
this
truck
I
think
you
can
revisit
that
offline
I,
don't
know.
Other
questions
are
the
way,
so
you
have
something
some
viable
solution,
one
we
already
discussed
but
just
to
clarify.
So
just
a
coded
text
over
ice
then
cold
as
faster
the
rider
the
rider
the
rider
options,
so
it
will
always
win
and
therefore
we
don't
need
that
is
already
encoded
method.
On
the
equate
text.
Yeah.
A
Then
we
decided
this
option
constructor
arguments
and
made
them
factory
methods.
So
now
it's
not
six
constructors
about
three
factory
methods,
static
methods
and
I.
Think
you
mentioned
this
already
Levi
is
that
it
should
be
called
yeah
encoding,
utf-8,
my
senators
of
span
of
bike
ride
and
a
binary
and
per
now
you
I
remove
the
string
property
because
I
don't
see,
I
need
for
it
as.
J
A
A
A
A
J
Know
we've
been
crazy
about
you
know,
trying
to
minimize
Alex
and,
and
things
like
that.
I
know
this
is
cash,
but
you
know
I've
gotten
a
ton
of
feedback
on
code
reviews
that
says:
hey
I,
don't
care
if
it's
cash,
you
should
still
you
know,
make
it
fast.
So
I'm
surprised
that
we're
actually
going
down
this
road
trip,
our
double
or
triple
encoding.
A
A
E
M
A
M
A
M
A
N
N
M
A
A
M
E
You
know
escaped
tag,
so
I
would
say
not
that
I
propose
that
we
do
it,
but
we
could
basically
say
we
just
use
the
underlying
equals
implementations
for
the
fields.
I
mean
that
seems
to
be
effectively
what
I
was
doing.
But
yeah
you
mean,
like
reference
equality
on
the
by
the
way.
Well,
not
battery,
because
we
binary
is
just
an
implementation
detail,
but
you.
E
A
E
Could
do
this
I,
don't
know,
there's
a
good
comment
like
you
know,
if
we
don't
have
a
scenario
that
we
shouldn't
spend
time
on.
It
second
thing
makes
me
think
like
geez.
This,
this
thing
literally
represents
a
string,
it's
kind
of
weird
that
you
cannot
compare
them
in
the
same
way.
Moreover,
we're
gonna
have,
you
know
equals
that
takes
an
object.
What
are
you
gonna
do
inside.